|
1 | 1 | name: Build |
2 | | - |
3 | 2 | on: |
4 | 3 | push: |
5 | 4 | branches: |
6 | 5 | - main |
7 | 6 |
|
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
8 | 10 | jobs: |
9 | 11 | build: |
10 | 12 | runs-on: ubuntu-latest |
11 | 13 | steps: |
12 | 14 | - name: Checkout repository |
13 | 15 | uses: actions/checkout@v4 |
14 | | - |
| 16 | + with: |
| 17 | + fetch-depth: 0 # Needed for git operations |
| 18 | + |
15 | 19 | - name: Setup Node.js |
16 | 20 | uses: actions/setup-node@v4 |
17 | 21 | with: |
18 | 22 | node-version: '18' |
19 | 23 | cache: 'npm' |
20 | | - |
| 24 | + |
21 | 25 | - name: Install dependencies |
22 | 26 | run: npm install |
23 | | - |
| 27 | + |
24 | 28 | - name: Build project |
25 | 29 | run: npm run build |
26 | | - |
27 | | - - name: Upload dist artifact |
| 30 | + |
| 31 | + - name: Create dist archive |
| 32 | + run: zip -r jellobounce.zip dist/ |
| 33 | + |
| 34 | + - name: Upload jellobounce.zip artifact |
28 | 35 | uses: actions/upload-artifact@v4 |
29 | 36 | with: |
30 | | - name: dist |
31 | | - path: dist/ |
| 37 | + name: jellobounce |
| 38 | + path: jellobounce.zip |
| 39 | + |
| 40 | + - name: Generate version tag |
| 41 | + id: version_tag |
| 42 | + run: | |
| 43 | + COMMIT_HASH=$(git rev-parse --short HEAD) |
| 44 | + TAG="build-$COMMIT_HASH-$(date +'%Y%m%d%H%M%S')" |
| 45 | + echo "version=$TAG" >> $GITHUB_OUTPUT |
32 | 46 |
|
33 | | - # Uncomment the sections below if you want to create GitHub releases |
34 | | - # |
35 | | - # - name: Create dist archive |
36 | | - # run: zip -r dist.zip dist/ |
37 | | - # |
38 | | - # - name: Generate version tag |
39 | | - # id: version_tag |
40 | | - # run: | |
41 | | - # COMMIT_HASH=$(git rev-parse --short HEAD) |
42 | | - # TAG="build-$COMMIT_HASH-$(date +'%Y%m%d%H%M%S')" |
43 | | - # echo "version=$TAG" >> $GITHUB_OUTPUT |
44 | | - # |
45 | | - # - name: Create and push Git tag |
46 | | - # run: | |
47 | | - # git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
48 | | - # git config --local user.name "github-actions[bot]" |
49 | | - # git tag ${{ steps.version_tag.outputs.version }} |
50 | | - # git push origin ${{ steps.version_tag.outputs.version }} |
51 | | - # |
52 | | - # - name: Upload to GitHub Release |
53 | | - # uses: softprops/action-gh-release@v1 |
54 | | - # with: |
55 | | - # files: dist.zip |
56 | | - # token: ${{ secrets.GITHUB_TOKEN }} |
57 | | - # tag_name: ${{ steps.version_tag.outputs.version }} |
58 | | - # prerelease: false |
59 | | - # name: "Build Release ${{ steps.version_tag.outputs.version }}" |
| 47 | + - name: Create and push Git tag |
| 48 | + run: | |
| 49 | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 50 | + git config --local user.name "github-actions[bot]" |
| 51 | + git tag ${{ steps.version_tag.outputs.version }} |
| 52 | + git push origin ${{ steps.version_tag.outputs.version }} |
| 53 | +
|
| 54 | + - name: Upload to GitHub Release |
| 55 | + uses: softprops/action-gh-release@v1 |
| 56 | + with: |
| 57 | + files: jellobounce.zip |
| 58 | + tag_name: ${{ steps.version_tag.outputs.version }} |
| 59 | + prerelease: false |
| 60 | + name: "Build Release ${{ steps.version_tag.outputs.version }}" |
0 commit comments