-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (51 loc) · 1.96 KB
/
pr.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
name: "🏷️ Tag on PR merge"
on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- main
jobs:
run_on_merge:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: "📦 Checkout"
uses: actions/checkout@v4
- name: "🔍 Find the current version"
id: find_version
run: |
RELEASE_VERSION=$(sed -n '2p' Configurations/Project-Shared.xcconfig | cut -d '=' -f2 | tr -d ' ')
echo "Found version: v$RELEASE_VERSION"
echo "NEW_RELEASE_VERSION=v$RELEASE_VERSION" >> $GITHUB_ENV
- name: "🔑 Set up GPG"
id: setup_gpg
env:
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
echo "default-key ${{ env.GPG_KEY_ID }}" > $HOME/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> $HOME/.gnupg/gpg.conf
git config --global user.signingkey ${{ env.GPG_KEY_ID }}
git config --global commit.gpgsign true
- name: "🏷️ Create a signed tag"
id: create_tag
env:
NEW_RELEASE_VERSION: ${{ steps.find_version.outputs.NEW_RELEASE_VERSION }}
run: |
git config user.name "surpher"
git config user.email "${{ secrets.GPG_EMAIL }}"
git tag -s -a ${{ env.NEW_RELEASE_VERSION }} -m "Release ${{ env.NEW_RELEASE_VERSION }}"
git push origin ${{ env.NEW_RELEASE_VERSION }}
- name: "🚀 Create a release"
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
NEW_RELEASE_VERSION: ${{ steps.find_version.outputs.NEW_RELEASE_VERSION }}
with:
tag_name: ${{ env.NEW_RELEASE_VERSION }}
release_name: "Release: ${{ env.NEW_RELEASE_VERSION }}"
body: "Release ${{ env.NEW_RELEASE_VERSION }}"
draft: false
prerelease: false