Skip to content

Commit

Permalink
リリース自動化ワークフローを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
mass-0910 committed Sep 30, 2023
1 parent 34d1df3 commit a8c62a8
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: release

on:
push:
tags:
- 'v*'

jobs:
test:
name: リリース作業
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: cache HSP3.6
id: cache-hsp36
uses: actions/cache@v3
with:
path: C:/hsp36
key: ${{ runner.os }}-hsp36
restore-keys: |
${{ runner.os }}-hsp36
- name: download HSP3.6
if: ${{ steps.cache-hsp36.outputs.cache-hit != 'true' }}
uses: robinraju/[email protected]
with:
repository: "onitama/OpenHSP"
tag: "v3.6"
fileName: "hsp36en.zip"

- name: unzip hsp36en.zip
if: ${{ steps.cache-hsp36.outputs.cache-hit != 'true' }}
run: 7z x hsp36en.zip -oC:/

- name: add hsp36 to path
shell: pwsh
run: echo "C:/hsp36" >> $env:GITHUB_PATH

- name: compile hsptest
shell: pwsh
run: |
hspcmp -o"compile.ax" --compath="C:/hsp36/common" ./compile.hsp
cp common/* C:/hsp36/common/
hsp3cl compile.ax
- name: create artifact zip file
shell: pwsh
run: |
mkdir hsptest
Copy-Item -Recurse -Path common -Destination hsptest/common
Copy-Item -Path hsptest.exe -Destination hsptest
Copy-Item -Path install.bat -Destination hsptest
Copy-Item -Path run_hsptest.bat -Destination hsptest
7z a -tzip hsptest.zip hsptest
- name: get previout tag name
id: get_previous_tag
shell: bash
run: |
git fetch -a
echo value=$(git tag --sort "-committerdate" | cut -d$'\n' -f2) >> $GITHUB_OUTPUT
- name: fetch auto generated release note
id: generate_release_note
shell: bash
run: |
echo "release_note=$(curl -X POST -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/releases/generate-notes -d '{"tag_name":"${{ github.ref_name }}", "previous_tag_name":"${{ steps.get_previous_tag.outputs.value }}", "configuration_file_path":".github/release_note.yml"}' | jq .body | sed 's/"//g' | sed s/\\\\n/\\$'\n'/g)" >> generated_release_note.txt
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: hsptest ${{ github.ref_name }}
body_path: ./generated_release_note.txt

- name: upload zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./hsptest.zip
asset_name: hsptest.zip
asset_content_type: application/zip

0 comments on commit a8c62a8

Please sign in to comment.