diff --git a/.github/workflows/image-build.yml b/.github/workflows/build-app.yml similarity index 67% rename from .github/workflows/image-build.yml rename to .github/workflows/build-app.yml index 1fec96f..8e9060a 100644 --- a/.github/workflows/image-build.yml +++ b/.github/workflows/build-app.yml @@ -1,13 +1,10 @@ -name: Build Docker Image +name: Build Application on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + - push jobs: - image-build: + build: runs-on: ubuntu-latest steps: @@ -25,5 +22,5 @@ jobs: - name: Generate code run: make gen - - name: Build Docker image - run: make image-build + - name: Build application + run: make build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec607f5..82b6058 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,29 +1,30 @@ -name: Build Application +name: Build image on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + - push jobs: build: runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' + - uses: actions/checkout@v6 + + - name: Set up Docker runtime + uses: docker/setup-buildx-action@v3 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: yarn install + + - name: Generate code + run: make gen - - name: Install dependencies - run: yarn install - - - name: Generate code - run: make gen - - - name: Build application - run: make build + - name: Build image + uses: docker/build-push-action@v6 + with: + context: . + push: false diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..bd31064 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,49 @@ +name: Release image + +on: + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v6 + + - name: Set up Docker runtime + uses: docker/setup-buildx-action@v3 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: yarn install + + - name: Generate code + run: make gen + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set image name + run: echo "IMAGE_NAME=ghcr.io/hyperleda/hyperleda-webapp" >> $GITHUB_ENV + + - name: Set short SHA + run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }} + ${{ env.IMAGE_NAME }}:latest diff --git a/.github/workflows/lint.yml b/.github/workflows/tests.yml similarity index 81% rename from .github/workflows/lint.yml rename to .github/workflows/tests.yml index d9aecc0..f9599a5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/tests.yml @@ -1,10 +1,7 @@ -name: Format and lint +name: Static checks & tests on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + - push jobs: lint: