[ci skip] Add manual release action

This commit is contained in:
Davide De Rosa 2021-12-01 13:30:04 +01:00
parent a199955b2d
commit ae6cb4e8dc
3 changed files with 48 additions and 26 deletions

48
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'TunnelKit version (e.g. 3.12.6)'
required: true
jobs:
run_tests:
runs-on: macos-11
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Run tests
run: |
swift test
publish_release:
runs-on: ubuntu-latest
needs: run_tests
steps:
- uses: actions/checkout@v2
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
git_push_gpgsign: false
- name: Tag release
env:
VERSION: ${{ github.event.inputs.version }}
run: |
DATE=`date "+%Y-%m-%d"`
COMMIT_MESSAGE="[ci skip] Set release date"
TAG_MESSAGE="Release"
sed -i'' -E "s/^## Unreleased.*$/## $VERSION ($DATE)/" CHANGELOG.md
git add CHANGELOG.md
git commit -m "$COMMIT_MESSAGE"
git tag "v$VERSION" -m "$TAG_MESSAGE"
git push && git push --tags

View File

@ -11,9 +11,6 @@ jobs:
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: maxim-lobanov/setup-xcode@v1 - uses: maxim-lobanov/setup-xcode@v1
with: with:
xcode-version: latest-stable xcode-version: latest-stable

View File

@ -1,23 +0,0 @@
#!/bin/sh
VERSION=$1
if [[ -z $VERSION ]]; then
echo "Version required"
exit
fi
if !(git checkout master && git tag -as "$VERSION" -m "Release"); then
echo "Error while tagging release"
exit
fi
if !(git push && git push github); then
echo "Error while pushing master"
exit
fi
if !(git push --tags && git push --tags github); then
echo "Error while pushing tags"
exit
fi
if !(git checkout stable && git merge master && git push github); then
echo "Error while pushing stable"
exit
fi
git checkout master