From ae6cb4e8dcb7109ca18ab0b0ea979bae17239c1d Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Wed, 1 Dec 2021 13:30:04 +0100 Subject: [PATCH] [ci skip] Add manual release action --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 3 --- scripts/push-release.sh | 23 ----------------- 3 files changed, 48 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100755 scripts/push-release.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4098592 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 334dad0..0138693 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,9 +11,6 @@ jobs: timeout-minutes: 10 steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable diff --git a/scripts/push-release.sh b/scripts/push-release.sh deleted file mode 100755 index 03c7b88..0000000 --- a/scripts/push-release.sh +++ /dev/null @@ -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