Skip to content

Commit cd45836

Browse files
authored
Add release creation to GitHub Actions workflow
1 parent 1414956 commit cd45836

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

.github/workflows/dev-build.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,40 @@ jobs:
4444
*/build/
4545
retention-days: 14
4646

47+
- name: Create Release
48+
if: github.ref == 'refs/heads/main'
49+
id: create_release
50+
uses: actions/create-release@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
tag_name: v${{ github.run_number }}
55+
release_name: Release v${{ github.run_number }}
56+
draft: false
57+
prerelease: false
58+
body: |
59+
Automated release from GitHub Actions build #${{ github.run_number }}
60+
61+
Contains build artifacts from all example projects.
62+
63+
- name: Zip Artifacts
64+
if: github.ref == 'refs/heads/main'
65+
run: |
66+
cd ${{ github.workspace }}
67+
zip -r build-artifacts.zip */dist/ */build/
68+
69+
- name: Upload Release Assets
70+
if: github.ref == 'refs/heads/main'
71+
uses: actions/upload-release-asset@v1
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
with:
75+
upload_url: ${{ steps.create_release.outputs.upload_url }}
76+
asset_path: ./build-artifacts.zip
77+
asset_name: build-artifacts.zip
78+
asset_content_type: application/zip
79+
4780
permissions:
48-
contents: read
81+
contents: write
4982
pages: write
5083
id-token: write

0 commit comments

Comments
 (0)