From 0795125f834e40c4ac3f899e7e2c6b52a733ee51 Mon Sep 17 00:00:00 2001 From: Dinh-Van Date: Sat, 23 Apr 2022 15:40:10 +0200 Subject: [PATCH] chore(ci): add manual release workflow --- .github/workflows/build.js.yml | 1 + .github/workflows/publish.js.yml | 69 ++++++++++++++++++++++++++++++++ .github/workflows/release.js.yml | 40 +++--------------- .github/workflows/version.js.yml | 3 +- 4 files changed, 77 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/publish.js.yml diff --git a/.github/workflows/build.js.yml b/.github/workflows/build.js.yml index 868a3b64..ba91bf70 100644 --- a/.github/workflows/build.js.yml +++ b/.github/workflows/build.js.yml @@ -11,6 +11,7 @@ on: push: branches: [ main ] pull_request: + workflow_dispatch: env: node_version: 16.x diff --git a/.github/workflows/publish.js.yml b/.github/workflows/publish.js.yml new file mode 100644 index 00000000..62b38a68 --- /dev/null +++ b/.github/workflows/publish.js.yml @@ -0,0 +1,69 @@ +# 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: Publish - Package release and publish + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + tags: + # Ignore release candidates + - 'v[0-9]+.[0-9]+.[0-9]+' + workflow_dispatch: + +env: + node_version: 16.x + +jobs: + release: + name: Publish + runs-on: ubuntu-latest + + steps: + - name: Checkout branch ${{ github.ref }} + uses: actions/checkout@v3 + + - name: Setup Node.js ${{ env.node_version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.node_version }} + cache: 'yarn' + + - name: Clean install dependencies + run: yarn install + + - name: Build application + run: yarn build + + - name: Zip build folder + run: | + # 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: yarn changelog + + - name: Push Release to github + uses: softprops/action-gh-release@v1 + with: + 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: | + # 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" diff --git a/.github/workflows/release.js.yml b/.github/workflows/release.js.yml index 3f17201b..91f865bc 100644 --- a/.github/workflows/release.js.yml +++ b/.github/workflows/release.js.yml @@ -8,10 +8,7 @@ concurrency: cancel-in-progress: true on: - push: - tags: - # Ignore release candidates - - 'v[0-9]+.[0-9]+.[0-9]+' + workflow_dispatch: env: node_version: 16.x @@ -34,35 +31,8 @@ jobs: - name: Clean install dependencies run: yarn install - - name: Build application - run: yarn build + - name: Release + run: yarn release - - name: Zip build folder - run: | - # 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: yarn changelog - - - name: Push Release to github - uses: softprops/action-gh-release@v1 - with: - 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: | - # 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" + - name: Push to remote + run: git push origin --follow-tags diff --git a/.github/workflows/version.js.yml b/.github/workflows/version.js.yml index 04bd5fc3..e47d63a1 100644 --- a/.github/workflows/version.js.yml +++ b/.github/workflows/version.js.yml @@ -10,6 +10,7 @@ concurrency: on: push: branches: [ main ] + workflow_dispatch: env: node_version: 16.x @@ -18,7 +19,7 @@ jobs: version: name: Bump version runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, 'chore(release)') && !contains(github.event.head_commit.message, 'chore(version)')" + if: "!contains(github.event.head_commit.message, 'chore')" env: old_version: ''