Skip to content

Commit

Permalink
Update release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hzoo authored Feb 25, 2025
1 parent 9f91208 commit f3ad161
Showing 1 changed file with 43 additions and 38 deletions.
81 changes: 43 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,68 @@
env:
DIRECTORY: src
PROJECT_NAME: contributors-on-github

# FILE GENERATED WITH: npx ghat fregante/ghatemplates/webext
# SOURCE: https://github.com/fregante/ghatemplates
# OPTIONS: {"set":["on.schedule=[{\"cron\": \"41 12 1 * *\"}]"]}

name: Release
on:
workflow_dispatch: null
schedule:
- cron: 41 12 1 * *
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@v2
- uses: actions/checkout@v4
- 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:
fetch-depth: 20
- uses: fregante/daily-version-action@v2
name: Create tag if necessary
id: daily-version
- uses: fregante/release-with-changelog@v3
if: steps.daily-version.outputs.created
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" ./*
# Create as draft to curate it before sending it out
gh release create "$DAILY_VERSION" "$FILENAME" --draft --generate-notes
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@v2
- 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@3 upload --auto-publish
;;
firefox)
cd $DIRECTORY && npx web-ext@8
;;
esac
- uses: actions/checkout@v4
- 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 }}
Firefox:
if: needs.Version.outputs.created
needs: Version
name: Submit (Firefox)
environment: Firefox
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Upload build and source code
run: npx web-ext@8 sign --channel listed
working-directory: artifact
env:
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}

0 comments on commit f3ad161

Please sign in to comment.