generated from LizardByte/template-base
-
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 2.01 KB
/
ci.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
60
61
62
63
64
65
66
67
---
name: CI
on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
push:
branches: [master]
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
action:
environment:
${{ github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository &&
'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Release
id: setup-release
uses: LizardByte/setup-release-action@master # keep this on master, to prevent endless depandabot PRs
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # can use GITHUB_TOKEN for read-only access
- name: Set action variables
id: vars
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
release_tag=pr-${{ github.event.pull_request.number }}-${{ github.run_id }}
else
release_tag=${{ steps.setup-release.outputs.release_tag }}
fi
# set outputs
echo "release_tag=$release_tag" >> $GITHUB_OUTPUT
- name: Run Action
id: action
uses: ./
with:
allowUpdates: false
artifacts: ''
body: ${{ steps.setup-release.outputs.release_body }}
generateReleaseNotes: ${{ steps.setup-release.outputs.release_generate_release_notes }}
name: ${{ steps.vars.outputs.release_tag }}
prerelease: true
tag: ${{ steps.vars.outputs.release_tag }}
token: ${{ secrets.GH_BOT_TOKEN }}
- name: Sleep
if: ${{ always() && github.event_name == 'pull_request' }}
run: sleep 60
- name: Delete Release
env:
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
if: ${{ always() && github.event_name == 'pull_request' }}
run: |
gh release delete ${{ steps.vars.outputs.release_tag }} --cleanup-tag --yes