Skip to content

Commit 062caaa

Browse files
committed
Fix release GitHub Action
1 parent 6ad4868 commit 062caaa

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

.github/workflows/create-release.yml

+29-2
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,47 @@ name: Release
33
on:
44
workflow_run:
55
workflows: [CI]
6-
branches: [main]
76
types: [completed]
87

98
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.event.workflow_run.head_branch, 'v') }}
12+
outputs:
13+
status: ${{ steps.check.conclusion }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-tags: true
19+
- id: check
20+
name: Verify that the ref is a tag (and not just a branch starting with "v")
21+
run: git show-ref --verify refs/tags/${{ github.event.workflow_run.head_branch }}
22+
1023
release:
1124
runs-on: ubuntu-latest
12-
if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.ref, 'refs/tags/') }}
25+
needs: check
26+
if: needs.check.outputs.status == 'success'
1327
steps:
1428
- name: Checkout
1529
uses: actions/checkout@v4
1630
- uses: taiki-e/install-action@parse-changelog
1731
- name: Generate Changelog
1832
run: parse-changelog CHANGELOG.md > ${{ github.workspace }}-CHANGELOG.md
33+
- name: Download JAR
34+
uses: actions/download-artifact@v4
35+
with:
36+
name: jsonoid-discovery.jar
37+
github-token: ${{ secrets.GH_PAT }}
38+
run-id: ${{ github.event.workflow_run.id }}
39+
- name: Make source archive
40+
run: git archive --format tar.gz --prefix=jsonoid-discovery-${{ github.event.workflow_run.head_branch }}/ HEAD > jsonoid-discovery-${{ github.event.workflow_run.head_branch }}.tar.gz
1941
- name: Release
2042
uses: softprops/action-gh-release@v1
2143
with:
2244
body_path: ${{ github.workspace }}-CHANGELOG.md
45+
files: |
46+
jsonoid-discovery*.jar
47+
jsonoid-discovery-*.tar.gz
48+
fail_on_unmatched_files: true
49+
tag_name: ${{ github.event.workflow_run.head_branch }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ fuzz/test/resources/*
3333

3434
# Bowtie
3535
bowtie/
36+
37+
*.tar.gz

0 commit comments

Comments
 (0)