Skip to content

Commit

Permalink
fix: STRF-10157 Divide docker image release and semantic (#1012)
Browse files Browse the repository at this point in the history
  • Loading branch information
jairo-bc authored Oct 27, 2022
1 parent 085684d commit 7a2f869
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 41 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/pull_request_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ name: Tests
on:
pull_request:
branches: [master, main]
push:
branches: [master, main]

jobs:
build:
Expand All @@ -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 }}

Expand Down
42 changes: 5 additions & 37 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Stencil CLI
name: Stencil CLI Release

on:
release:
types: [created]
push:
branches: [master, main]

jobs:
build:
Expand All @@ -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
Expand All @@ -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 }}
39 changes: 39 additions & 0 deletions .github/workflows/release_image.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 7a2f869

Please sign in to comment.