Skip to content

Commit

Permalink
build(docker): move docker release to release workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Dec 30, 2023
1 parent e908a2c commit 686804b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 28 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ name: Create and publish a Docker image

on:
push:
branches: ['master', 'develop']
tags:
- 'v*'
branches: ['develop']
pull_request:
branches:
- '*'
Expand Down Expand Up @@ -38,12 +36,7 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=edge,branch=develop
type=semver,pattern={{version}}
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
type=sha
- name: Set up QEMU
Expand Down
78 changes: 58 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,19 @@ on:
description: New version number in X.Y.Z
required: true

jobs:
update-master-branch:
runs-on: ubuntu-latest
steps:
- uses: everlytic/[email protected]
with:
github_token: ${{ secrets.PAT }}
source_ref: 'develop'
target_branch: 'master'
commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push-version-number:
needs: ['update-master-branch']
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
- name: Checkout develop branch
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: 'master'
ref: 'develop'

- name: get-npm-version
id: package-version
Expand All @@ -48,9 +41,20 @@ jobs:
message: 'chore: push version number to v${{ github.event.inputs.version }}'
push: true

release:
update-master-branch:
needs: ['push-version-number']
runs-on: ubuntu-latest
steps:
- uses: everlytic/[email protected]
with:
github_token: ${{ secrets.PAT }}
source_ref: 'develop'
target_branch: 'master'
commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}'

release:
needs: ['update-master-branch']
runs-on: ubuntu-latest
steps:
- name: Fetch repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -110,16 +114,50 @@ jobs:
exclude: .htaccess
local-dir: ./dist/

update-develop-branch:
build-and-push-image:
needs: ['release']
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: everlytic/[email protected]
- name: Checkout repository
uses: actions/checkout@v4
with:
github_token: ${{ secrets.PAT }}
source_ref: 'master'
target_branch: 'develop'
commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}'
ref: 'refs/tags/v${{ github.event.inputs.version }}'

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

update-changelog:
needs: ['update-develop-branch']
Expand Down

0 comments on commit 686804b

Please sign in to comment.