-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (89 loc) · 3.15 KB
/
release.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
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: release
on:
workflow_dispatch:
inputs:
VERSION:
description: "The version to release"
required: true
IS_PRE_RELEASE:
description: "It IS a pre-release"
required: true
default: true
type: boolean
jobs:
release:
runs-on: ubuntu-latest
env:
VERSION: ${{ inputs.VERSION }}
GH_TOKEN: ${{ github.token }}
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
permissions:
contents: write
steps:
- name: ensure proper tagging
run: |
echo "If it's a pre-release, the version should contain a hyphen"
if [ ${{ inputs.IS_PRE_RELEASE }} = true ]; then
if [[ $VERSION != *-* ]]; then
echo "Pre-release versions should contain a hyphen"
exit 1
fi
else
if [[ $VERSION == *-* ]]; then
echo "Release versions should not contain a hyphen"
exit 1
fi
fi
- name: ensure version is not already released
run: |
if git ls-remote --tags origin | grep -q "refs/tags/$VERSION"; then
echo "Version $VERSION already exists"
exit 1
fi
- name: configure git with the bot credentials
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.NEXTMVBOT_SSH_KEY }}"
echo "${{ secrets.NEXTMVBOT_SIGNING_KEY }}" > ~/.ssh/signing.key
chmod 600 ~/.ssh/signing.key
git config --global user.name "nextmv-bot"
git config --global user.email "tech+gh-nextmv-bot@nextmv.io"
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/signing.key
git clone git@github.com:nextmv-io/go-highs.git
cd go-highs
git checkout ${{ github.ref_name }}
git rev-parse --short HEAD
- name: bump version in version file
run: |
echo $VERSION > VERSION
working-directory: ./go-highs
- name: commit version bump
run: |
git add VERSION
git commit -m "Bumping version to $VERSION"
git push origin ${{ github.ref_name }}
working-directory: ./go-highs
- name: push release tag
run: |
git tag $VERSION
git push origin $VERSION
working-directory: ./go-highs
- name: create release
run: |
PRERELEASE_FLAG=""
if [ ${{ inputs.IS_PRE_RELEASE }} = true ]; then
PRERELEASE_FLAG="--prerelease"
fi
gh release create $VERSION \
--verify-tag \
--generate-notes \
--title $VERSION $PRERELEASE_FLAG
working-directory: ./go-highs
- name: notify slack
if: ${{ inputs.IS_PRE_RELEASE == false }}
run: |
export DATA="{\"text\":\"Release notification - go-highs $VERSION (see <https://github.com/nextmv-io/go-highs/releases/$VERSION|release notes>)\"}"
curl -X POST -H 'Content-type: application/json' --data "$DATA" ${{ secrets.SLACK_URL_MISSION_CONTROL }}