-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
47 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,59 @@ | ||
env: | ||
DIRECTORY: distribution | ||
PROJECT_NAME: notifier-for-github | ||
|
||
# FILE GENERATED WITH: npx ghat fregante/ghatemplates/webext | ||
# FILE GENERATED WITH: npx ghat fregante/ghatemplates/webext/release.yml | ||
# SOURCE: https://github.com/fregante/ghatemplates | ||
# OPTIONS: {"set":["on.schedule=[{\"cron\": \"21 12 * * 3\"}]"]} | ||
# OPTIONS: {"exclude":["on.schedule"]} | ||
|
||
name: Release | ||
on: | ||
workflow_dispatch: null | ||
schedule: | ||
- cron: 21 12 * * 3 | ||
jobs: | ||
Version: | ||
outputs: | ||
created: ${{ steps.daily-version.outputs.created }} | ||
version: ${{ steps.daily-version.outputs.version }} | ||
created: ${{ env.DAILY_VERSION_CREATED }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
fetch-depth: 20 | ||
- name: install | ||
run: npm ci || npm install | ||
# TODO: Fix tests | ||
# - run: npm test | ||
- uses: fregante/daily-version-action@v1 | ||
name: Create tag if necessary | ||
id: daily-version | ||
- uses: fregante/release-with-changelog@v3 | ||
if: steps.daily-version.outputs.created | ||
node-version-file: package.json | ||
cache: npm | ||
- run: npm ci | ||
- name: Test and build | ||
run: npm test | ||
- name: Create tag if necessary | ||
uses: fregante/daily-version-action@v2 | ||
- name: Update manifest.json with version ${{ env.DAILY_VERSION}} | ||
if: env.DAILY_VERSION_CREATED | ||
run: npx dot-json@1 "$DIRECTORY/manifest.json" version "$DAILY_VERSION" | ||
- name: Ready for "submit" jobs | ||
if: env.DAILY_VERSION_CREATED | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
exclude: true | ||
Submit: | ||
path: ${{ env.DIRECTORY }} | ||
- name: Create release | ||
if: env.DAILY_VERSION_CREATED | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
working-directory: ${{ env.DIRECTORY }} | ||
run: | | ||
FILENAME="$PROJECT_NAME-$DAILY_VERSION-for-local-testing-only.zip" | ||
zip -r "$FILENAME" ./* | ||
gh release create "$DAILY_VERSION" --generate-notes "$FILENAME" | ||
Chrome: | ||
if: needs.Version.outputs.created | ||
needs: Version | ||
if: github.event_name == 'workflow_dispatch' || needs.Version.outputs.created | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
command: | ||
- firefox | ||
- chrome | ||
name: Submit (Chrome) | ||
environment: Chrome | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: install | ||
run: npm ci || npm install | ||
- run: npm run build --if-present | ||
- name: Update extension’s meta | ||
run: >- | ||
npx dot-json@1 $DIRECTORY/manifest.json version ${{ | ||
needs.Version.outputs.version }} | ||
- name: Submit | ||
run: | | ||
case ${{ matrix.command }} in | ||
chrome) | ||
cd $DIRECTORY && npx chrome-webstore-upload-cli@1 upload --auto-publish | ||
;; | ||
firefox) | ||
cd $DIRECTORY && npx web-ext-submit@5 | ||
;; | ||
esac | ||
- uses: actions/download-artifact@v4 | ||
- run: npx chrome-webstore-upload-cli@3 | ||
working-directory: artifact | ||
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 }} |