Build and release TsuBeta script #31
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: script-tsumbeta-actions | |
run-name: Build and release TsuBeta script | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- scripts/com.r2studio.TsumBeta/** | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
if: github.repository == 'mcs/robotmon-scripts' | |
defaults: | |
run: | |
working-directory: ./scripts/com.r2studio.TsumBeta | |
steps: | |
- name: Check out the repository to the runner | |
uses: actions/checkout@v4 | |
- name: Get npm cache directory | |
id: npm-cache-dir | |
shell: bash | |
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Make the script files executable | |
run: chmod +x build.sh | |
- name: Compile sources and create index.zip | |
run: ./build.sh | |
- name: Archive index.zip artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: index-zip | |
path: scripts/com.r2studio.TsumBeta/index.zip | |
retention-days: 1 | |
overwrite: true | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: github.repository == 'mcs/robotmon-scripts' | |
needs: build | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: index-zip | |
- name: Test artifact download | |
run: ls -R | |
- name: Delete old release and its tag | |
uses: dev-drprasad/[email protected] | |
with: | |
tag_name: tsumbeta_latest_dev | |
delete_release: true | |
github_token: ${{ secrets.GITHUB_TOKEN }} # (required) - a GitHub token with write access to the repo where tags and releases will be searched and deleted | |
continue-on-error: true | |
- name: Release artifact | |
id: create-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: tsumbeta_latest_dev | |
release_name: Latest TsumBeta development release | |
draft: false | |
prerelease: true | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
asset_path: ./index.zip | |
asset_name: index.zip | |
asset_content_type: application/zip |