-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add wf to check ags version * add build and release ci
- Loading branch information
1 parent
af65146
commit bd6f492
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Check AGS Package Version | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'ags/**' # Trigger only if files in the `ags` package have changed | ||
|
||
jobs: | ||
check_version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get current branch version of ags package | ||
id: current_version | ||
run: | | ||
jq -r '.version' ags/package.json > current_version.txt | ||
echo "current_version=$(cat current_version.txt)" >> $GITHUB_ENV | ||
- name: Get main branch version of ags package | ||
run: | | ||
git fetch origin main | ||
git show origin/main:ags/package.json | jq -r '.version' > main_version.txt | ||
echo "main_version=$(cat main_version.txt)" >> $GITHUB_ENV | ||
- name: Check for changes in the ags package | ||
id: check_changes | ||
run: | | ||
if git diff --quiet origin/main -- ags/; then | ||
echo "has_changes=false" >> $GITHUB_ENV | ||
else | ||
echo "has_changes=true" >> $GITHUB_ENV | ||
fi | ||
- name: Fail if version is not updated | ||
if: env.has_changes == 'true' && env.current_version == env.main_version | ||
run: | | ||
echo "Code has changed in the ags package, but the version has not been updated." | ||
exit 1 | ||
env: | ||
current_version: ${{ env.current_version }} | ||
main_version: ${{ env.main_version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Publish and Release AGS Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish_npm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Get version of the ags package | ||
id: get_version | ||
run: | | ||
VERSION=$(jq -r '.version' ags/package.json) | ||
echo "ags_version=$VERSION" >> $GITHUB_ENV | ||
- name: Publish ags package to npm | ||
run: npm publish --workspace ags | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
if: contains(github.event.head_commit.message, 'chore(release)') | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: "ags-v${{ env.ags_version }}" | ||
release_name: "AGS Library v${{ env.ags_version }}" | ||
body: | | ||
Release of version ${{ env.ags_version }} of the AGS library. | ||
draft: false | ||
prerelease: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |