Skip to content

📦 Release - Tag, release and publish package #14

📦 Release - Tag, release and publish package

📦 Release - Tag, release and publish package #14

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: 📦 Release - Tag, release and publish package
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
tagName:
description: 'Tag name'
required: false
env:
node_version: 20.x
jobs:
release:
name: 📦 Release
runs-on: ubuntu-latest
steps:
- name: ⛙ Checkout branch ${{ github.ref }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🏗️ Setup Node.js ${{ env.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
cache: 'yarn'
- name: 🏗️ Install dependencies
run: |
# ================= 🏗️ Install dependencies =================
yarn install
- name: 🏷️ Tag and bump Release
run: |
# ================= 🏷️ Tab and bump =================
# setup git creds
git config user.name "GitHub Release Bot"
git config user.email "<>"
# generate release
yarn release
- name: ⛙ Push to remote
run: |
# ================= ⛙ Push to remote =================
# Check status
git status
git diff --color -U0 | cat
# push changes
git push origin --follow-tags
publish-store:
needs: release
name: 🔌 Publish extension
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'failure' }}
steps:
- name: ⛙ Checkout branch ${{ github.ref }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🚧 Build
uses: ./.github/actions/build
with:
node_version: ${{ env.node_version }}
mode: extension
- name: 🗃️ Zip build folder
run: |
# ================= 🗃️ Zipping build folder =================
# Zipping build folder for artifact upload
cd build;
zip -r synology-download.zip *
# Check zip created
echo "Zip created in 'build/'"
ls -l synology-download.zip
cd ..
- name: 📝 Generate Release changelog
run: |
# ================= 📝 Generate Release changelog =================
yarn release:changelog
- name: 🏷️ Fetch latest tag
if: ${{ github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tagName == '') }}
id: latest-tag
run: |
# ================= 🏷️ Fetch tags =================
tag_name=$(git describe --abbrev=0 --match 'v*')
echo "Tag found: '$tag_name'"
echo "::set-output name=TAG_NAME::$tag_name"
- name: 📦 Push Release to github
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tagName || steps.latest-tag.outputs.TAG_NAME || github.ref}}
body_path: RELEASE.md
files: build/synology-download.zip
- name: 🔌 Publish to Chrome webstore
env:
CHROME_WEB_STORE_EXTENSION_ID: ebbdkledlkjpgbbmmopgbnnjmklnkcef
CHROME_WEB_STORE_CLIENT_ID: ${{ secrets.CHROME_WEB_STORE_CLIENT_ID }}
CHROME_WEB_STORE_CLIENT_SECRET: ${{ secrets.CHROME_WEB_STORE_CLIENT_SECRET }}
CHROME_WEB_STORE_REFRESH_TOKEN: ${{ secrets.CHROME_WEB_STORE_REFRESH_TOKEN }}
run: |
# ================= Publish to Chrome store =================
# Uploadind zip to web store
yarn dlx -q chrome-webstore-upload-cli upload --source build/synology-download.zip --extension-id "$CHROME_WEB_STORE_EXTENSION_ID" --client-id "$CHROME_WEB_STORE_CLIENT_ID" --client-secret "$CHROME_WEB_STORE_CLIENT_SECRET" --refresh-token "$CHROME_WEB_STORE_REFRESH_TOKEN"
publish-npm:
needs: release
name: ☁️ Publish npm
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'failure' }}
steps:
- name: ⛙ Checkout branch ${{ github.ref }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🚧 Build
uses: ./.github/actions/build
with:
node_version: ${{ env.node_version }}
mode: web:ci
- name: ☁️ Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# ================= ☁️ Publish to npm =================
npm publish
- name: 💾 Caching build artefacts
uses: actions/cache/save@v3
id: cache
with:
path: dist
key: ${{ github.ref }}-${{ github.run_id }}-build
deploy:
name: 🚀 Deploy
needs: publish-npm
uses: ./.github/workflows/deploy.yml
secrets: inherit