From 8d261e0fdd31a303ffd55b9cfc66f0712b8950e5 Mon Sep 17 00:00:00 2001 From: kogeler <25884155+kogeler@users.noreply.github.com> Date: Sat, 13 Jul 2024 11:36:29 +0300 Subject: [PATCH] Docker images CI was changed (#69) * Docker images CI was changed --- .github/workflows/{tags.yml => docker.yml} | 20 +++++++++++++++----- .github/workflows/pr.yml | 16 ++++++++-------- 2 files changed, 23 insertions(+), 13 deletions(-) rename .github/workflows/{tags.yml => docker.yml} (71%) diff --git a/.github/workflows/tags.yml b/.github/workflows/docker.yml similarity index 71% rename from .github/workflows/tags.yml rename to .github/workflows/docker.yml index 00effcb..5f3ca48 100644 --- a/.github/workflows/tags.yml +++ b/.github/workflows/docker.yml @@ -1,7 +1,10 @@ -name: Build and push tag as Docker image +name: Build and push Docker images on: push: + branches: + - master + - dev tags: - 'v*' @@ -22,10 +25,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Set environmental variables - id: env-vars - run: | - echo "FULL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-node-js-${{ matrix.node-js-image-version }}-subql-node-${{ matrix.subql-node-image-version }}" >> "$GITHUB_ENV" - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx @@ -41,6 +40,17 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Set image label for the master branch + if: ${{ github.ref_type == 'branch' && github.ref_name == 'master' }} + run: | + echo "IMAGE_LABEL=latest" >> "$GITHUB_ENV" + - name: Set image label for a tag or other branches + if: ${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && github.ref_name != 'master') }} + run: | + echo "IMAGE_LABEL=${{ github.ref_name }}" >> "$GITHUB_ENV" + - name: Set full name of the Docker image + run: | + echo "FULL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_LABEL }}-node-js-${{ matrix.node-js-image-version }}-subql-node-${{ matrix.subql-node-image-version }}" >> "$GITHUB_ENV" - name: Build and push Docker image uses: docker/build-push-action@v6 with: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0b7c19e..44f0a2d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,19 +1,19 @@ -name: PR +name: PR check on: pull_request: - paths-ignore: - - ".github/workflows/**" + jobs: pr: - name: pr + name: build project runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Node.js environment - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: - node-version: 18 - - run: yarn + node-version: 20 + - name: Install + run: yarn install - name: Codegen run: yarn codegen - name: Build