|
1 | 1 | env: |
2 | 2 | DIRECTORY: src |
| 3 | + PROJECT_NAME: contributors-on-github |
3 | 4 |
|
4 | 5 | # FILE GENERATED WITH: npx ghat fregante/ghatemplates/webext |
5 | 6 | # SOURCE: https://github.com/fregante/ghatemplates |
6 | | -# OPTIONS: {"set":["on.schedule=[{\"cron\": \"41 12 1 * *\"}]"]} |
7 | 7 |
|
8 | 8 | name: Release |
9 | 9 | on: |
10 | 10 | workflow_dispatch: null |
11 | | - schedule: |
12 | | - - cron: 41 12 1 * * |
13 | 11 | jobs: |
14 | 12 | Version: |
15 | 13 | outputs: |
16 | | - created: ${{ steps.daily-version.outputs.created }} |
17 | | - version: ${{ steps.daily-version.outputs.version }} |
| 14 | + created: ${{ env.DAILY_VERSION_CREATED }} |
18 | 15 | runs-on: ubuntu-latest |
19 | 16 | steps: |
20 | | - - uses: actions/checkout@v2 |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + - name: Create tag if necessary |
| 19 | + uses: fregante/daily-version-action@v2 |
| 20 | + - name: Update manifest.json with version ${{ env.DAILY_VERSION}} |
| 21 | + if: env.DAILY_VERSION_CREATED |
| 22 | + run: npx dot-json@1 "$DIRECTORY/manifest.json" version "$DAILY_VERSION" |
| 23 | + - name: Ready for "submit" jobs |
| 24 | + if: env.DAILY_VERSION_CREATED |
| 25 | + uses: actions/upload-artifact@v4 |
21 | 26 | with: |
22 | | - fetch-depth: 20 |
23 | | - - uses: fregante/daily-version-action@v2 |
24 | | - name: Create tag if necessary |
25 | | - id: daily-version |
26 | | - - uses: fregante/release-with-changelog@v3 |
27 | | - if: steps.daily-version.outputs.created |
28 | | - with: |
29 | | - token: ${{ secrets.GITHUB_TOKEN }} |
30 | | - exclude: true |
31 | | - Submit: |
| 27 | + path: ${{ env.DIRECTORY }} |
| 28 | + - name: Create release |
| 29 | + if: env.DAILY_VERSION_CREATED |
| 30 | + env: |
| 31 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + working-directory: ${{ env.DIRECTORY }} |
| 33 | + run: | |
| 34 | + FILENAME="$PROJECT_NAME-$DAILY_VERSION-for-local-testing-only.zip" |
| 35 | + zip -r "$FILENAME" ./* |
| 36 | + # Create as draft to curate it before sending it out |
| 37 | + gh release create "$DAILY_VERSION" "$FILENAME" --draft --generate-notes |
| 38 | + Chrome: |
| 39 | + if: needs.Version.outputs.created |
32 | 40 | needs: Version |
33 | | - if: github.event_name == 'workflow_dispatch' || needs.Version.outputs.created |
34 | | - strategy: |
35 | | - fail-fast: false |
36 | | - matrix: |
37 | | - command: |
38 | | - - firefox |
39 | | - - chrome |
| 41 | + name: Submit (Chrome) |
| 42 | + environment: Chrome |
40 | 43 | runs-on: ubuntu-latest |
41 | 44 | steps: |
42 | | - - uses: actions/checkout@v2 |
43 | | - - name: Update extension’s meta |
44 | | - run: >- |
45 | | - npx dot-json@1 $DIRECTORY/manifest.json version ${{ |
46 | | - needs.Version.outputs.version }} |
47 | | - - name: Submit |
48 | | - run: | |
49 | | - case ${{ matrix.command }} in |
50 | | - chrome) |
51 | | - cd $DIRECTORY && npx chrome-webstore-upload-cli@3 upload --auto-publish |
52 | | - ;; |
53 | | - firefox) |
54 | | - cd $DIRECTORY && npx web-ext@8 |
55 | | - ;; |
56 | | - esac |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + - uses: actions/download-artifact@v4 |
| 47 | + - run: npx chrome-webstore-upload-cli@3 |
| 48 | + working-directory: artifact |
57 | 49 | env: |
58 | 50 | EXTENSION_ID: ${{ secrets.EXTENSION_ID }} |
59 | 51 | CLIENT_ID: ${{ secrets.CLIENT_ID }} |
60 | 52 | CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} |
61 | 53 | REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} |
| 54 | + Firefox: |
| 55 | + if: needs.Version.outputs.created |
| 56 | + needs: Version |
| 57 | + name: Submit (Firefox) |
| 58 | + environment: Firefox |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + - uses: actions/download-artifact@v4 |
| 63 | + - name: Upload build and source code |
| 64 | + run: npx web-ext@8 sign --channel listed |
| 65 | + working-directory: artifact |
| 66 | + env: |
62 | 67 | WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }} |
63 | 68 | WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }} |
0 commit comments