-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (43 loc) · 1.75 KB
/
publish-source.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# This workflow takes care of building and publishing the source code of the Danish Public Libraries CMS.
name: Publish source
on: create
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Validate the format of the tag. We only want to react on a precise pattern.
- name: Detect release tag
id: detect_tag
run: |
if [[ "${{ github.ref }}" =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]
then
echo ::set-output name=IS_RELEASE_TAG::true
else
echo ::set-output name=IS_RELEASE_TAG::false
fi
# Extract version from tag.
- name: Get version
id: get_version
run: |
echo ::set-output name=RELEASE_TAG::$(echo ${GITHUB_REF#refs/tags/} | cut -d '_' -f 2)
if: ${{ steps.detect_tag.outputs.IS_RELEASE_TAG == 'true' }}
# Write version to .version file.
- name: Create .version file
run: |
echo "{\"version\": \"${{ steps.get_version.outputs.RELEASE_TAG }}\"}" > .version
if: ${{ steps.detect_tag.outputs.IS_RELEASE_TAG == 'true' }}
# Install go-task since we need it for building the source package.
- name: Install go-task
uses: arduino/setup-task@v2
if: ${{ steps.detect_tag.outputs.IS_RELEASE_TAG == 'true' }}
- name: Build and publish source
run: |
echo "Publishing tag: $RELEASE_TAG"
RELEASE_IMAGE_TAG=$RELEASE_TAG RELEASE_IMAGE_REGISTRY=ghcr.io/${{ github.repository_owner}} task source:deploy
if: ${{ steps.detect_tag.outputs.IS_RELEASE_TAG == 'true' }}
env:
CR_PAT: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.get_version.outputs.RELEASE_TAG }}