Skip to content

Commit 3788668

Browse files
committed
Update GitHub Actions workflow for testing and release
This commit modifies the GitHub Actions workflow to enhance the testing and release process. It includes changes to the event triggers, updates the checkout action version, and refines the release steps to ensure proper version tagging and release note generation. The workflow now runs tests and checks before packaging and releasing the code, improving overall CI/CD efficiency.
1 parent 31ceaf5 commit 3788668

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

.github/workflows/workflow.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
on: [push, pull_request_target]
2-
name: Test and lint
1+
on:
2+
push:
3+
branches:
4+
- main
5+
name: Test, lint, and release GitHub Action
36

47
jobs:
58

6-
lint:
9+
test-unit:
710
runs-on: ubuntu-latest
811
steps:
9-
- uses: actions/checkout@master
12+
- uses: actions/checkout@v5
1013
- run: npm test
1114

1215
package_check:
1316
runs-on: ubuntu-latest
1417
steps:
15-
- uses: actions/checkout@master
16-
- name: "Ensure that code has been packaged and commited"
18+
- uses: actions/checkout@v5
19+
- name: "Ensure that code has been packaged and committed"
1720
run: |-
1821
npm install
1922
npm run package
@@ -26,7 +29,7 @@ jobs:
2629
matrix:
2730
os: [ ubuntu-latest, macos-latest, windows-latest ]
2831
steps:
29-
- uses: actions/checkout@master
32+
- uses: actions/checkout@v5
3033

3134
- name: Install deck with token and team id
3235
uses: ./
@@ -47,23 +50,29 @@ jobs:
4750

4851
release:
4952
runs-on: ubuntu-latest
50-
needs: [lint, package_check, test]
53+
needs: [test-unit, package_check, test]
5154
permissions:
5255
contents: write
53-
actions: write
5456
steps:
55-
- uses: actions/checkout@master
57+
- uses: actions/checkout@v5
58+
with:
59+
fetch-depth: 0
60+
61+
- name: Bump version and push tag
62+
id: tag_version
63+
uses: mathieudutour/github-tag-action@v6.2
64+
with:
65+
github_token: ${{ secrets.GITHUB_TOKEN }}
5666

5767
- name: Create Release
5868
uses: softprops/action-gh-release@v2
59-
if: github.ref_type == 'tag'
6069
with:
70+
tag_name: ${{ steps.tag_version.outputs.new_tag }}
6171
generate_release_notes: true
6272

6373
- name: Update v1.0 tag
64-
if: github.ref_type == 'tag'
6574
run: |
6675
git config user.name "github-actions[bot]"
6776
git config user.email "github-actions[bot]@users.noreply.github.com"
68-
git tag -f v1.0 ${{ github.ref_name }}
77+
git tag -f v1.0 ${{ steps.tag_version.outputs.new_tag }}
6978
git push origin v1.0 --force

0 commit comments

Comments
 (0)