-
Notifications
You must be signed in to change notification settings - Fork 3
73 lines (69 loc) · 2.96 KB
/
config-pr-3-bump-tag.yml
File metadata and controls
73 lines (69 loc) · 2.96 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# This workflow is used to convert the `.version` in the `metadata.yaml` file into a valid `git tag` on push to `release-*`.
# We use the `.version` field in that file to denote the version of the config once a PR is merged.
name: Bump Tag
on:
workflow_call:
# Workflows that call this workflow use the following triggers:
# push:
# branches:
# - 'release-*'
# paths:
# - 'metadata.yaml'
jobs:
tag-update:
name: Check and Update Tag
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
- name: Existing Tag Check
# Check if the tag already exists, if it does, we don't want to move it.
id: tag
run: |
VERSION=$(yq '.version' metadata.yaml)
VERSION_TAG=${{ github.ref_name }}-$VERSION
VERSION_TAG_ON_GIT=$(git tag -l $VERSION_TAG)
if [[ "$VERSION" == "null" ]]; then
echo "::warning::Version is null. Skipping."
exit 1
elif [ -n "$VERSION_TAG_ON_GIT" ]; then
echo "::warning::Tag $VERSION_TAG already exists. Skipping."
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "version=$VERSION_TAG" >> $GITHUB_OUTPUT
fi
- name: Import Commit-Signing Key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
with:
gpg_private_key: ${{ secrets.GH_ACTIONS_BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GH_ACTIONS_BOT_GPG_PASSPHRASE }}
git_config_global: true
git_committer_name: ${{ vars.GH_ACTIONS_BOT_GIT_USER_NAME }}
git_committer_email: ${{ vars.GH_ACTIONS_BOT_GIT_USER_EMAIL }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Update Tag
if: steps.tag.outputs.exists == 'false'
env:
TAG: ${{ steps.tag.outputs.version }}
STATUS: ${{ endsWith(steps.tag.outputs.version, '.0') && 'breaking' || 'preserving' }}
run: |
git tag ${{ env.TAG }} -m "Repro-${{ env.STATUS }} update to ${{ github.ref_name }} via model-config-tests 'config-pr-3-bump-tag.yml' workflow."
git push --tags
- name: Create Release
if: steps.tag.outputs.exists == 'false'
env:
TAG: ${{ steps.tag.outputs.version }}
IS_REPRO_BREAK: ${{ endsWith(steps.tag.outputs.version, '.0') && 'DOES' || 'does not' }}
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 #v0.1.15
with:
tag_name: ${{ env.TAG }}
name: Configuration ${{ env.TAG }}
body: |
This released configuration ${{ env.IS_REPRO_BREAK }} break reproducibility with released configurations before it. See the 'Config Tags' section in the `README.md` for more information.
generate_release_notes: true