Build And Release on Windows #504
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
name: Build And Release on Windows | |
on: | |
workflow_dispatch: | |
inputs: | |
revision: | |
description: 'Revision' | |
required: false | |
default: '' | |
repository_dispatch: | |
inputs: | |
revision: | |
description: 'Revision' | |
required: false | |
default: '' | |
jobs: | |
build: | |
name: Build | |
needs: create_release | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
id: build | |
shell: bash | |
run: | | |
nice -n -20 node -e 'const{spawn:spawn}=require("child_process"),bat=spawn("cmd.exe",["/c","setup.bat"]);bat.stdout.on("data",function(t){process.stdout.write(t)}),bat.stderr.on("data",function(t){process.stderr.write(t)});' | |
echo "zip_path=$(cygpath -w -a vice/*.7z)" >> $GITHUB_OUTPUT | |
echo "zip_name=$(basename vice/*.7z)" >> $GITHUB_OUTPUT | |
- name: Release | |
id: upload | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.build.outputs.zip_path }} | |
asset_name: ${{ steps.build.outputs.zip_name }} | |
asset_content_type: application/x-7z-compressed | |
create_release: | |
name: Prepare Release | |
runs-on: windows-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
release_id: ${{ steps.create_release.outputs.id }} | |
steps: | |
- name: Get revision | |
shell: bash | |
run: | | |
echo "revision=$(svn info --show-item last-changed-revision svn://svn.code.sf.net/p/vice-emu/code/trunk/vice@${{ github.event.inputs.revision }})" >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.WF }} | |
with: | |
tag_name: r${{ env.revision }} | |
release_name: r${{ env.revision }} Windows | |
draft: true | |
prerelease: true | |
publish_release: | |
name: Publish Release | |
needs: [create_release, build] | |
runs-on: windows-latest | |
steps: | |
- name: Get revision | |
shell: bash | |
run: | | |
echo -e '### Changelog:\n\n```text' >revbody.txt | |
svn log -l 5 svn://svn.code.sf.net/p/vice-emu/code/trunk/vice@${{ env.revision }} | sed -e '2,$!d' >>revbody.txt | |
echo -e '```' >>revbody.txt | |
for a in $(curl -qs https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows/newtest.yml/runs|grep -B 1 "Build And Release"|grep id|tr -d " ,"|cut -d ":" -f 2);do curl -qs -X DELETE -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ secrets.WF }} " "https://api.github.com/repos/$GITHUB_REPOSITORY/actions/runs/$a";done | |
- uses: actions/github-script@v3 | |
with: | |
github-token: ${{secrets.WF}} # ${{secrets.GITHUB_TOKEN}} | |
script: | | |
fs=require("fs"); | |
github.repos.updateRelease( | |
{ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: fs.readFileSync('revbody.txt', 'utf8').toString(), | |
release_id: ${{ needs.create_release.outputs.release_id }}, | |
draft: false, | |
prerelease: false, | |
release: true | |
}); | |