From 7a2f869e59255310dc5dcff06642a56e2cafc3bc Mon Sep 17 00:00:00 2001 From: Jairo <68893868+jairo-bc@users.noreply.github.com> Date: Thu, 27 Oct 2022 15:32:51 +0200 Subject: [PATCH] fix: STRF-10157 Divide docker image release and semantic (#1012) --- .github/workflows/pull_request_review.yml | 6 ++-- .github/workflows/release.yml | 42 +++-------------------- .github/workflows/release_image.yml | 39 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/release_image.yml diff --git a/.github/workflows/pull_request_review.yml b/.github/workflows/pull_request_review.yml index a6e1e46a..e0fc9982 100644 --- a/.github/workflows/pull_request_review.yml +++ b/.github/workflows/pull_request_review.yml @@ -6,8 +6,6 @@ name: Tests on: pull_request: branches: [master, main] - push: - branches: [master, main] jobs: build: @@ -20,10 +18,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc2958ba..47fe82f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,8 @@ -name: Stencil CLI +name: Stencil CLI Release + on: - release: - types: [created] + push: + branches: [master, main] jobs: build: @@ -11,7 +12,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: '14.x' - - run: npm ci + - run: npm i - name: Check Git Commit name run: git log -1 --pretty=format:"%s" | npx commitlint # Setup .npmrc file to publish to npm registry @@ -22,36 +23,3 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GA_USERNAME: ${{ secrets.PAT_USERNAME }} GA_TOKEN: ${{ secrets.PAT_TOKEN }} - - build-and-push-image: - env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - runs-on: ubuntu-latest - permissions: - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push Docker image - uses: docker/build-push-action@v3 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release_image.yml b/.github/workflows/release_image.yml new file mode 100644 index 00000000..7229c05f --- /dev/null +++ b/.github/workflows/release_image.yml @@ -0,0 +1,39 @@ +name: Stencil CLI + +on: + release: + types: [created] + +jobs: + build-and-push-image: + env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + runs-on: ubuntu-latest + permissions: + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}