-
Notifications
You must be signed in to change notification settings - Fork 44
67 lines (55 loc) · 2.29 KB
/
release_pr_snapshot.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: Release a snapshot artifact for a PR
on:
workflow_run:
workflows: ['CI']
branches-ignore: ['dependabot/**']
types: [completed]
jobs:
release-snapshot-artifact:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' && github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download PR_NUMBER
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
run_id: ${{github.event.workflow_run.id }}
name: PR_NUMBER
path: .
- name: Extract PR number
id: extract-pr-number
run: |
pr_number=$(cat ./PR_NUMBER)
echo "PR_NUMBER=$pr_number" >> $GITHUB_OUTPUT
- name: Checkout project
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Checkout PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr checkout ${{ steps.extract-pr-number.outputs.PR_NUMBER }}
- name: Download dist folder
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
run_id: ${{github.event.workflow_run.id }}
name: dist
path: dist
- name: Remove `dist` from `.gitignore`
run: sed -i -E 's|^/?dist/?||g' .gitignore
- name: Create snapshot branch
uses: alejandrohdezma/actions/commit-and-push@v1
with:
message: 'Release snapshot for #${{ steps.extract-pr-number.outputs.PR_NUMBER }}'
force-push: 'true'
branch: snapshots/${{ steps.extract-pr-number.outputs.PR_NUMBER }}
- name: Create Comment
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
with:
recreate: true
header: snapshot
number: ${{ steps.extract-pr-number.outputs.PR_NUMBER }}
message: |
A snapshot release has been created as `snapshots/${{ steps.extract-pr-number.outputs.PR_NUMBER }}`.
You can test it out with:
```yaml
uses: scala-steward-org/scala-steward-action@snapshots/${{ steps.extract-pr-number.outputs.PR_NUMBER }}
```
It will be automatically recreated on any change to this PR.