musescore-downloader/.github/workflows/release.yml

117 lines
3.5 KiB
YAML
Raw Normal View History

2020-10-29 20:58:26 +00:00
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'The version number. default: the version number in package.json'
required: false
npm_tag:
description: 'The tag to register the published NPM package with'
required: false
default: 'latest'
ref:
description: 'The branch, tag or SHA to release from'
required: false
2020-12-08 19:48:03 +00:00
chrome_ext_url:
description: 'URL to the Chrome Extension crx'
required: true
2020-10-29 20:58:26 +00:00
env:
VERSION: ${{ github.event.inputs.version }}
NPM_TAG: ${{ github.event.inputs.npm_tag }}
2020-10-29 21:00:37 +00:00
REF: ${{ github.event.inputs.ref || github.sha }}
2020-10-30 21:38:04 +00:00
ARTIFACTS_DIR: ./.artifacts
2020-12-08 19:48:03 +00:00
CHROME_EXT_URL: ${{ github.event.inputs.chrome_ext_url }}
2020-10-29 20:58:26 +00:00
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
ref: ${{ env.REF }}
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Set Env
run: |
VER=$(node -p "require('./package.json').version")
echo "VERSION=$VER" >> $GITHUB_ENV
if: ${{ !env.VERSION }}
- run: npm install
- name: Bump Version
run: npm version --allow-same-version --no-git-tag $VERSION
- run: npm run build
- run: npm run pack:ext
- name: NPM Publish
run: npm publish --tag $NPM_TAG
2020-10-29 21:06:49 +00:00
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 0301...
2020-10-29 20:58:26 +00:00
2020-10-30 19:32:44 +00:00
- name: Publish Firefox Extension
id: web-ext-build
uses: kewisch/action-web-ext@v1
2020-10-30 01:27:50 +00:00
continue-on-error: true
with:
cmd: sign
source: dist/ext.zip
2020-10-30 19:00:58 +00:00
channel: listed
apiKey: ${{ secrets.AMO_SIGN_KEY }}
apiSecret: ${{ secrets.AMO_SIGN_SECRET }}
2020-10-30 21:38:04 +00:00
- run: |
mkdir -p $ARTIFACTS_DIR
cp dist/main.js $ARTIFACTS_DIR/musescore-downloader.user.js
cp dist/ext.zip $ARTIFACTS_DIR/musescore-downloader.webextension.zip
2020-12-08 19:48:03 +00:00
wget -q $CHROME_EXT_URL -P $ARTIFACTS_DIR/
2020-10-30 22:11:14 +00:00
- run: bash ./.github/workflows/get-signed-ext.sh
2020-10-30 21:32:58 +00:00
env:
EXT_ID: musescore-downloader
2020-10-30 21:38:04 +00:00
OUT_DIR: ${{ env.ARTIFACTS_DIR }}
2020-10-30 22:02:06 +00:00
- name: Upload to IPFS
uses: aquiladev/ipfs-action@v0.1.5
id: ipfs
with:
path: ${{ env.ARTIFACTS_DIR }}
service: infura
verbose: true
2020-10-29 20:58:26 +00:00
- name: Github Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2020-10-30 22:02:06 +00:00
IPFS_HASH: ${{ steps.ipfs.outputs.hash }}
2020-10-29 20:58:26 +00:00
run: |
2020-10-31 04:00:14 +00:00
cd $ARTIFACTS_DIR
files=$(ls .)
2020-10-30 21:32:58 +00:00
assets=()
for f in $files; do [ -f "$f" ] && assets+=(-a "$f"); done
2020-11-06 07:26:15 +00:00
SHORT_SHA=$(echo $REF | cut -c 1-7)
2020-10-29 20:58:26 +00:00
hub release create \
2020-10-30 21:32:58 +00:00
"${assets[@]}" \
2020-10-29 20:58:26 +00:00
-m v$VERSION \
2020-10-30 22:02:06 +00:00
-m "IPFS Hash: [$IPFS_HASH](https://ipfs.io/ipfs/$IPFS_HASH)" \
2020-11-06 19:10:32 +00:00
-m "Guess what? Mirrors!<br><https://github.com/musescore/MuseScore/tree/$SHORT_SHA><br><https://github.com/github/dmca/tree/$SHORT_SHA>" \
2020-10-29 20:58:26 +00:00
-t $REF \
v$VERSION
- name: Archive to archive.org
continue-on-error: true
env:
REPO: ${{ github.repository }}
run: |
URL="https://github.com/$REPO/releases/"
curl "https://web.archive.org/save/" \
--compressed -s \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-raw "url=$URL&capture_all=on" \
| grep github