-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58f1374
commit d754dcf
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
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: 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-mip.git | ||
cd go-mip | ||
git checkout ${{ github.ref_name }} | ||
- name: commit new version | ||
run: | | ||
git tag $VERSION | ||
git push origin $VERSION | ||
working-directory: ./go-mip | ||
|
||
- 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-mip |