Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Meta: Use GitHub Actions for automatic deployment #100

Merged
merged 7 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copied from https://github.com/notlmn/browser-extension-template/blob/master/.github/workflows/deployment.yml
name: Deployment

on:
workflow_dispatch:
# You can manually trigger a deployment on GitHub.com
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
schedule:
- cron: '42 4 * * 4' # At 04:42 every Thursday

jobs:
Build:
outputs:
shouldDeploy: ${{ steps.daily-version.outputs.created }} || github.event_name == 'workflow_dispatch'
notlmn marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 20
- run: npm ci
notlmn marked this conversation as resolved.
Show resolved Hide resolved
- uses: fregante/daily-version-action@v1
name: Create tag if necessary
id: daily-version
- uses: notlmn/release-with-changelog@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
template: '{commits}'
notlmn marked this conversation as resolved.
Show resolved Hide resolved
exclude: '^Meta|^Document|^Readme|^Lint'
fregante marked this conversation as resolved.
Show resolved Hide resolved
- name: Update extension’s meta
env:
VER: ${{ steps.daily-version.outputs.version }}
run: |
echo https://github.com/$GITHUB_REPOSITORY/tree/$VER > distribution/SOURCE_URL.txt
notlmn marked this conversation as resolved.
Show resolved Hide resolved
npm run version
notlmn marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/upload-artifact@v2
with:
path: distribution

Chrome:
needs: Build
if: needs.Build.outputs.shouldDeploy
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 }}

Firefox:
needs: Build
if: needs.Build.outputs.shouldDeploy
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- run: cd artifact && npx web-ext-submit@4
env:
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Test

on:
- pull_request
- push
notlmn marked this conversation as resolved.
Show resolved Hide resolved

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npm test
fregante marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"watch": "webpack --mode=development --watch",
"release:amo": "cd distribution && web-ext-submit",
"release:cws": "cd distribution && webstore upload --auto-publish",
"release": "run-s build update-version release:*",
"update-version": "dot-json distribution/manifest.json version $TRAVIS_TAG"
"release": "VER=$(daily-version) run-s build version release:*",
"version": "dot-json distribution/manifest.json version $VER"
},
"dependencies": {
"dom-chef": "^4.1.0",
Expand All @@ -26,6 +26,7 @@
"@types/terser-webpack-plugin": "^4.0.0",
"chrome-webstore-upload-cli": "^1.2.0",
"copy-webpack-plugin": "^6.0.3",
"daily-version": "^2.0.0",
"dot-json": "^1.2.0",
"eslint-config-xo-react": "^0.23.0",
"eslint-plugin-react": "^7.20.5",
Expand Down