diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml deleted file mode 100644 index 28d03c7..0000000 --- a/.github/workflows/deployment.yml +++ /dev/null @@ -1,56 +0,0 @@ -# Copied from https://github.com/notlmn/browser-extension-template/blob/master/.github/workflows/deployment.yml -name: Deployment - -on: - schedule: - - cron: '22 14 * * 3' # At 14:22 on Wednesday https://crontab.guru/#22_14_*_*_3 - push: - tags: - - "20.*" - - "21.*" - - "22.*" - - "23.*" - - "24.*" - -jobs: - - Version: - runs-on: ubuntu-latest - outputs: - version: ${{ steps.daily-version.outputs.version }} - created: ${{ steps.daily-version.outputs.created }} - steps: - - uses: actions/checkout@v2 - - uses: fregante/daily-version-action@v1 - name: Create tag if necessary - id: daily-version - - Build: - needs: Version - if: github.event_name == 'push' || needs.Version.outputs.created - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: npm install - - run: npm test - - name: Update extension’s meta - env: - VER: ${{ needs.Version.outputs.version }} - run: | - echo https://github.com/$GITHUB_REPOSITORY/tree/$VER > distribution/SOURCE_URL.txt - npm run version - - uses: actions/upload-artifact@v2 - with: - path: distribution - - Chrome: - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v2 - - run: cd artifact && npx chrome-webstore-upload-cli@1 upload --auto-publish - env: - EXTENSION_ID: ${{ secrets.EXTENSION_ID }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..906c6d2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +env: {} + +# DO NOT EDIT BELOW, USE: npx ghat fregante/ghatemplates/webext --set 'on.schedule=[{"cron": "22 14 * * 3"}]' --set 'jobs.Submit.strategy.matrix.command=["chrome"]' + +name: Release +on: + workflow_dispatch: null + schedule: + - cron: 22 14 * * 3 +jobs: + Version: + outputs: + created: '${{ steps.daily-version.outputs.created }}' + version: '${{ steps.daily-version.outputs.version }}' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 20 + - name: install + run: npm ci || npm install + - run: npm test + - uses: fregante/daily-version-action@v1 + name: Create tag if necessary + id: daily-version + - uses: notlmn/release-with-changelog@v3 + if: steps.daily-version.outputs.created + with: + token: '${{ secrets.GITHUB_TOKEN }}' + exclude: true + Submit: + needs: Version + if: github.event_name == 'workflow_dispatch' || needs.Version.outputs.created + strategy: + fail-fast: false + matrix: + command: + - chrome + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: install + run: npm ci || npm install + - run: npm run build + - name: Update extension’s meta + run: >- + npx dot-json distribution/manifest.json version ${{ + needs.Version.outputs.version }} + - run: 'npm run release:${{ matrix.command }}' + env: + EXTENSION_ID: '${{ secrets.EXTENSION_ID }}' + CLIENT_ID: '${{ secrets.CLIENT_ID }}' + CLIENT_SECRET: '${{ secrets.CLIENT_SECRET }}' + REFRESH_TOKEN: '${{ secrets.REFRESH_TOKEN }}' + WEB_EXT_API_KEY: '${{ secrets.WEB_EXT_API_KEY }}' + WEB_EXT_API_SECRET: '${{ secrets.WEB_EXT_API_SECRET }}' diff --git a/package.json b/package.json index 9db07f8..e7696bd 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,8 @@ "lint": "run-p lint:*", "lint:css": "stylelint 'source/*.css'", "lint:js": "eslint source --ext svelte", - "release:cws": "webstore upload --source=distribution --auto-publish", - "release": "VER=$(daily-version) run-s build version release:*", - "test": "run-p 'lint:*' build", - "version": "dot-json distribution/manifest.json version $VER", + "release:chrome": "cd distribution && webstore upload --auto-publish", + "test": "run-p lint:* build", "watch": "rollup --config --watch" }, "eslintConfig": {