From 0201fd08497c4d7189e735a6d16783094b84a832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Antu=C3=B1a=20D=C3=ADez?= Date: Thu, 25 Jul 2024 18:13:13 +0000 Subject: [PATCH 1/2] add changelog, create-tag and move-tag scripts to gha --- .github/changelog.json | 16 ++++++++++++++++ .github/scripts/create-tag.js | 14 ++++++++++++++ .github/scripts/move-tag.js | 15 +++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 .github/changelog.json create mode 100644 .github/scripts/create-tag.js create mode 100644 .github/scripts/move-tag.js diff --git a/.github/changelog.json b/.github/changelog.json new file mode 100644 index 00000000..8ea8d760 --- /dev/null +++ b/.github/changelog.json @@ -0,0 +1,16 @@ +{ + "categories": [ + { + "title": "## Features", + "labels": ["feature"] + }, + { + "title": "## Fixes", + "labels": ["bug", "fix"] + } + ], + "ignore_labels": ["L-ignore"], + "template": "${{CHANGELOG}}\n## Other\n\n${{UNCATEGORIZED}}", + "pr_template": "- ${{TITLE}} (#${{NUMBER}})", + "empty_template": "- No changes" +} \ No newline at end of file diff --git a/.github/scripts/create-tag.js b/.github/scripts/create-tag.js new file mode 100644 index 00000000..6ecd0bc9 --- /dev/null +++ b/.github/scripts/create-tag.js @@ -0,0 +1,14 @@ +module.exports = async ({ github, context }, tagName) => { + try { + await github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/tags/${tagName}`, + sha: context.sha, + force: true, + }); + } catch (err) { + console.error(`Failed to create tag: ${tagName}`); + console.error(err); + } +}; \ No newline at end of file diff --git a/.github/scripts/move-tag.js b/.github/scripts/move-tag.js new file mode 100644 index 00000000..580fa58e --- /dev/null +++ b/.github/scripts/move-tag.js @@ -0,0 +1,15 @@ +module.exports = async ({ github, context }, tagName) => { + try { + await github.rest.git.updateRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `tags/${tagName}`, + sha: context.sha, + force: true, + }); + } catch (err) { + console.error(`Failed to move nightly tag.`); + console.error(`This should only happen the first time.`); + console.error(err); + } +}; \ No newline at end of file From f38a2e795c4b107145b5276664fad616c7170d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Antu=C3=B1a=20D=C3=ADez?= Date: Thu, 25 Jul 2024 18:16:54 +0000 Subject: [PATCH 2/2] add nightly releases and adds ziskemu and riscv2zisk binnaries --- .github/workflows/release.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9e8ee32..b22f56d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ on: env: CARGO_TERM_COLOR: always + IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} permissions: contents: write @@ -169,9 +170,9 @@ jobs: [[ "$target" == *windows* ]] && exe=".exe" - RUSTFLAGS='-C target-feature=+crt-static' cargo build --release -p cargo-zisk --target "$target" "${flags[@]}" + RUSTFLAGS='-C target-feature=+crt-static' cargo build --release -p cargo-zisk -p ziskemu -p riscv2zisk --target "$target" "${flags[@]}" - bins=(cargo-zisk) + bins=(cargo-zisk ziskemu) for name in "${bins[@]}"; do bin=./target/$target/release/$name$exe file "$bin" || true @@ -189,16 +190,16 @@ jobs: shell: bash run: | if [ "$PLATFORM_NAME" == "linux" ]; then - tar -czvf "cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release cargo-zisk + tar -czvf "cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release cargo-zisk ziskemu riscv2zisk echo "file_name=cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT elif [ "$PLATFORM_NAME" == "darwin" ]; then # We need to use gtar here otherwise the archive is corrupt. # See: https://github.com/actions/virtual-environments/issues/2619 - gtar -czvf "cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release cargo-zisk + gtar -czvf "cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release cargo-zisk ziskemu riscv2zisk echo "file_name=cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT else cd ./target/${TARGET}/release - 7z a -tzip "cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" cargo-zisk.exe + 7z a -tzip "cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" cargo-zisk.exe ziskemu.exe riscv2zisk.exe mv "cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" ../../../ echo "file_name=cargo_zisk_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" >> $GITHUB_OUTPUT fi @@ -215,7 +216,6 @@ jobs: body: ${{ needs.prepare.outputs.changelog }} files: | ${{ steps.artifacts.outputs.file_name }} - ${{ steps.man.outputs.cargo_zisk_man }} # If this is a nightly release, it also updates the release # tagged `nightly` for compatibility with `ziskup` @@ -229,7 +229,6 @@ jobs: body: ${{ needs.prepare.outputs.changelog }} files: | ${{ steps.artifacts.outputs.file_name }} - ${{ steps.man.outputs.cargo_zisk_man }} cleanup: name: Release cleanup