Skip to content

Commit 7873451

Browse files
committed
Add release creation script.
1 parent 901bbad commit 7873451

3 files changed

Lines changed: 49 additions & 31 deletions

File tree

.github/workflows/create_draft_release.yml

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,6 @@ jobs:
1212
contents: write
1313

1414
steps:
15-
- name: Create Release
16-
env:
17-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
18-
run: |
19-
curl -X POST \
20-
-H "Authorization: token ${{ env.GITHUB_TOKEN }}" \
21-
-H "Accept: application/vnd.github+json" \
22-
-H "X-GitHub-Api-Version: 2022-11-28" \
23-
https://api.github.com/repos/${{ github.repository }}/releases \
24-
-d '{
25-
"tag_name": "${{ github.ref_name }}",
26-
"name": "DAP ${{ github.ref_name }}",
27-
"draft": true,
28-
"body": "# What is new in DAP"
29-
}'
3015
- name: Code Checkout
3116
uses: actions/checkout@v4
3217
- name: Install Node
@@ -37,20 +22,9 @@ jobs:
3722
- name: Install node dependencies
3823
run: npm ci
3924
- name: Build distribution
40-
run: npm run build
41-
- name: Upload build artifacts
42-
uses: actions/upload-artifact@v4
43-
with:
44-
name: dap-distribution
45-
path: dist
46-
- name: Upload Asset to Release
47-
env:
48-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
4925
run: |
50-
curl -X POST \
51-
-H "Authorization: token ${{ env.GITHUB_TOKEN }}" \
52-
-H "Accept: application/vnd.github+json" \
53-
-H "X-GitHub-Api-Version: 2022-11-28" \
54-
-H "Content-Type: application/octet-stream" \
55-
--data-binary ${{ steps.build_distribution.output }} \
56-
"${{ steps.create_release.outputs.upload_url }}?name=dap-${{ github.ref_name }}.zip"
26+
npm run build
27+
tar -czvf dap-${{ github.ref_name }}.tar.gz dist
28+
- name: Create draft release
29+
run: |
30+
create-draft-release.sh ${{ github.ref_name }} dap-${{ github.ref_name }}.tar.gz

create-draft-release.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Ensure GitHub CLI is authenticated
4+
if ! gh auth status &> /dev/null; then
5+
echo "GitHub CLI is not authenticated. Run 'gh auth login' first."
6+
exit 1
7+
fi
8+
9+
# Check if tag is provided
10+
if [[ -z "$1" ]]; then
11+
echo "Usage: $0 <tag> [asset]"
12+
exit 1
13+
fi
14+
15+
TAG=$1
16+
ASSET=$2
17+
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
18+
19+
# Create the release
20+
echo "Creating GitHub release for tag: $TAG"
21+
gh release create "$TAG" --repo "$REPO" --draft --title "DAP $TAG" --notes-file "release-notes.md"
22+
23+
# Upload asset if provided
24+
if [[ -n "$ASSET" ]]; then
25+
if [[ -f "$ASSET" ]]; then
26+
echo "Uploading asset: $ASSET"
27+
gh release upload "$TAG" "$ASSET" --repo "$REPO"
28+
else
29+
echo "Asset file not found: $ASSET"
30+
exit 1
31+
fi
32+
fi
33+
34+
echo "Release $TAG created successfully."

release-notes.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# What's new in DAP
2+
3+
## Features
4+
5+
## Bug fixes
6+
7+
## Security and privacy
8+
9+
## Agency-specific changes
10+

0 commit comments

Comments
 (0)