Skip to content

Commit

Permalink
update release action
Browse files Browse the repository at this point in the history
  • Loading branch information
ga-ebp committed Mar 27, 2024
1 parent e6b97bc commit 64b027c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
5 changes: 4 additions & 1 deletion .github/actions/create-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ inputs:
LATEST:
description: 'The latest tag of the image'
required: true
CACHE:
description: 'The cache tag of the image'
required: true
DOCKERFILE:
description: 'The path to the Dockerfile'
required: true
Expand Down Expand Up @@ -68,5 +71,5 @@ runs:
REVISION=${{ env.REVISION }}
tags: ${{ steps.meta-data.outputs.tags }}
labels: ${{ steps.meta-data.outputs.labels }}
cache-from: type=registry,ref=${{ inputs.IMAGE_NAME }}:${{ inputs.TAG }}
cache-from: type=registry,ref=${{ inputs.IMAGE_NAME }}:${{ inputs.CACHE }}
cache-to: type=inline
6 changes: 4 additions & 2 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
IMAGE_NAME: ${{ env.BASE_IMAGE_NAME }}-app
VERSION: ${{ env.VERSION }}
PREFIX: e
TAG: type=edge
TAG: edge
CACHE: e${{ env.VERSION }}
LATEST: false
DOCKERFILE: ./apps/client-asset-sg/docker/Dockerfile
TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -39,7 +40,8 @@ jobs:
IMAGE_NAME: ${{ env.BASE_IMAGE_NAME }}-api
VERSION: ${{ env.VERSION }}
PREFIX: e
TAG: type=edge
TAG: edge
CACHE: e${{ env.VERSION }}
LATEST: false
DOCKERFILE: ./apps/server-asset-sg/docker/Dockerfile
TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 6 additions & 4 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ jobs:
with:
IMAGE_NAME: ${{ env.BASE_IMAGE_NAME }}-app
VERSION: ${{ env.VERSION }}
PREFIX: rc
PREFIX: v
TAG: release-candidate
CACHE: edge
LATEST: false
DOCKERFILE: ./apps/client-asset-sg/docker/Dockerfile
TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -35,8 +36,9 @@ jobs:
with:
IMAGE_NAME: ${{ env.BASE_IMAGE_NAME }}-api
VERSION: ${{ env.VERSION }}
PREFIX: rc
PREFIX: v
TAG: release-candidate
CACHE: edge
LATEST: false
DOCKERFILE: ./apps/server-asset-sg/docker/Dockerfile
TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -45,8 +47,8 @@ jobs:
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
tag_name: v${{ env.VERSION }}
release_name: v${{ env.VERSION }}
body_path: CHANGELOG.md
commitish: develop
prerelease: true
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: release

on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: "Tag Name"
VERSION:
description: "Version number (e.g. 1.2.3)"
required: true

env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
VERSION: ${{ github.event.inputs.VERSION }}
BASE_IMAGE_NAME: ghcr.io/geoadmin/swissgeol-assets
GH_TOKEN: ${{ github.token }}

Expand All @@ -28,9 +26,10 @@ jobs:
uses: ./.github/actions/create-image
with:
IMAGE_NAME: ${{ env.BASE_IMAGE_NAME }}-app
VERSION: ${{ env.TAG_NAME }}
VERSION: ${{ env.VERSION }}
PREFIX: v
TAG: release
CACHE: release-candidate
LATEST: true
DOCKERFILE: ./apps/client-asset-sg/docker/Dockerfile
TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -39,9 +38,10 @@ jobs:
uses: ./.github/actions/create-image
with:
IMAGE_NAME: ${{ env.BASE_IMAGE_NAME }}-api
VERSION: ${{ env.TAG_NAME }}
VERSION: ${{ env.VERSION }}
PREFIX: v
TAG: release
CACHE: release-candidate
LATEST: true
DOCKERFILE: ./apps/server-asset-sg/docker/Dockerfile
TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -56,9 +56,9 @@ jobs:

- name: Set environment variables
run: |
echo GIT_BRANCH_NAME=mark-version-${TAG_NAME#v}-as-released >> $GITHUB_ENV
echo GIT_COMMIT_MESSAGE=Mark version ${TAG_NAME#v} as released >> $GITHUB_ENV
echo RELEASE_ID=$(gh api -H "Accept: application/vnd.github+json" /repos/${GITHUB_REPOSITORY}/releases/tags/${TAG_NAME} | jq '.id') >> $GITHUB_ENV
echo GIT_BRANCH_NAME=mark-version-${VERSION#v}-as-released >> $GITHUB_ENV
echo GIT_COMMIT_MESSAGE=Mark version ${VERSION#v} as released >> $GITHUB_ENV
echo RELEASE_ID=$(gh api -H "Accept: application/vnd.github+json" /repos/${GITHUB_REPOSITORY}/releases/tags/v${VERSION} | jq '.id') >> $GITHUB_ENV
- name: Get changelog for this specific release and update release notes
run: |
Expand All @@ -71,7 +71,7 @@ jobs:
- name: Checkout new branch and patch changelog
run: |
git checkout -b $GIT_BRANCH_NAME
sed -i "/^\#\# \[Unreleased\]$/a \\\n\#\# $TAG_NAME - $(date '+%Y-%m-%d')" CHANGELOG.md
sed -i "/^\#\# \[Unreleased\]$/a \\\n\#\# $VERSION - $(date '+%Y-%m-%d')" CHANGELOG.md
- name: Commit, push and create pull request
run: |
Expand Down

0 comments on commit 64b027c

Please sign in to comment.