-
Notifications
You must be signed in to change notification settings - Fork 708
49 lines (44 loc) · 1.44 KB
/
create-tag.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
name: Create tag for release
on:
pull_request:
types:
- closed
workflow_dispatch:
inputs:
commit:
description: 'Commit hash'
required: true
type: string
jobs:
create-tag:
if: >-
(inputs.commit || false) ||
(github.event.pull_request.merged == true &&
github.event.pull_request.user.login == 'github-actions' &&
github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name &&
startsWith(github.event.pull_request.head.ref, 'bump-version') )
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute the commit
run: |
if [[ -z "${{ inputs.commit }}" ]]; then
COMMIT=$(git rev-parse ${{ github.sha }}^@ | grep -Fvx ${{ github.event.pull_request.head.sha }})
else
COMMIT="${{ inputs.commit }}"
fi
echo "commit=$COMMIT" >> $GITHUB_ENV
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Extract version
run: |
echo "version=$(cargo pkgid -p bindgen | cut -d '#' -f 2)" >> $GITHUB_ENV
- name: Create tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_sha: ${{ env.commit }}
custom_tag: ${{ env.version }}