Skip to content

Commit

Permalink
build(docker): remove build docker back to separate workflow and add …
Browse files Browse the repository at this point in the history
…PAT to release step

Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Dec 30, 2023
1 parent 62ec391 commit b669a75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 50 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Create and publish a Docker image
on:
push:
branches: ['develop']
tags:
- 'v*'
pull_request:
branches:
- '*'
Expand Down Expand Up @@ -36,7 +38,12 @@ 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
52 changes: 2 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ on:
description: New version number in X.Y.Z
required: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push-version-number:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -54,6 +50,7 @@ jobs:

release:
needs: ['update-master-branch']
name: Build and release
runs-on: ubuntu-latest
steps:
- name: Fetch repo
Expand Down Expand Up @@ -96,7 +93,7 @@ jobs:
with:
name: v${{ github.event.inputs.version }}
tag_name: v${{ github.event.inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.PAT }}
files: ./mainsail.zip
body: ${{ steps.generate-changelog.outputs.content }}

Expand All @@ -114,51 +111,6 @@ jobs:
exclude: .htaccess
local-dir: ./dist/

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

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
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: ['release']
name: Generate changelog
Expand Down

0 comments on commit b669a75

Please sign in to comment.