Skip to content

Commit

Permalink
Build updates on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Richard committed Aug 7, 2024
1 parent d4ac462 commit d4c1870
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,22 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: minor
- name: Build
run: pnpm bump && pnpm build
env:
KEY: ${{ secrets.KEY }}
KEY_PASSPHRASE: ${{ secrets.KEY_PASSPHRASE }}
VERSION: ${{ steps.tag_version.outputs.new_tag }}
- name: Get all tags
uses: octokit/[email protected]
id: get_latest_release
with:
route: GET /repos/${{ github.repository }}/git/matching-refs/tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: "echo latest release: '${{ steps.get_latest_release.outputs.data }}'"
- name: Build
run: pnpm bump && pnpm build
env:
KEY: ${{ secrets.KEY }}
KEY_PASSPHRASE: ${{ secrets.KEY_PASSPHRASE }}
VERSION: ${{ steps.tag_version.outputs.new_tag }}
TAGS: ${{ steps.get_latest_release.outputs.data }}
- name: Echo update
run: cat update.json
- name: Upload SWBN
uses: actions/upload-artifact@v4
with:
Expand Down
21 changes: 15 additions & 6 deletions bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ fs.writeFileSync(
JSON.stringify(manifest, null, 2),
);

let versions;

try {
versions = JSON.parse(process.env.TAGS).map((tag) => {
const v = tag.ref.replace('refs/tags/v', '');
return {
version: v,
src: tag.url,
};
});
} catch (e) {
throw new Error('No tags');
}

const updateManifest = {
versions: [
{
version,
src: `/v${version}/package.swbn`,
},
],
versions,
};

fs.writeFileSync('./update.json', JSON.stringify(updateManifest));

0 comments on commit d4c1870

Please sign in to comment.