-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically publish to Chrome, Firefox, NPM and GitHub (#1080)
(cherry picked from commit 334e387)
- Loading branch information
1 parent
bcdd302
commit fcd6979
Showing
2 changed files
with
164 additions
and
43 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 |
---|---|---|
|
@@ -103,8 +103,43 @@ jobs: | |
run: node scripts/download-panes.js | ||
env: | ||
EMBER_ENV: production | ||
- name: Update manifest.json | ||
if: github.event_name == 'schedule' | ||
run: | | ||
DATE="$(date +"%Y.%m.%d")" | ||
SHA="${GITHUB_SHA:0:7}" | ||
VERSION="$(jq -r '.version' package.json)" | ||
CONTENT="$(cat "$FILE")" | ||
echo "$CONTENT" | jq --arg date "$DATE" --arg sha "$SHA" --arg version "$VERSION" "$FILTER" > $FILE | ||
cat "$FILE" | ||
env: | ||
FILE: skeletons/web-extension/manifest.json | ||
FILTER: >- | ||
.name += " (Nightly)" | | ||
.version = $date | | ||
.version_name = "\($version) (nightly build \($date) / \($sha))" | ||
- name: Update package.json | ||
if: github.event_name == 'schedule' | ||
run: | | ||
DATE="$(date +"%Y.%m.%d")" | ||
SHA="${GITHUB_SHA:0:7}" | ||
CONTENT="$(cat "$FILE")" | ||
echo "$CONTENT" | jq --arg date "$DATE" --arg sha "$SHA" "$FILTER" > $FILE | ||
cat "$FILE" | ||
env: | ||
FILE: package.json | ||
FILTER: .version += "-alpha.\($date)+\($sha)" | ||
- name: Build | ||
run: yarn ember build --environment production | ||
- name: Pack | ||
run: | | ||
VERSION="$(jq -r '.version | split("+") | .[0]' package.json)" | ||
yarn pack | ||
mkdir -p dist/npm | ||
tar xvzf "ember-inspector-v$VERSION.tgz" -C dist/npm --strip-components 1 | ||
- name: Upload artifacts (bookmarklet) | ||
uses: actions/upload-artifact@master | ||
with: | ||
|
@@ -129,8 +164,9 @@ jobs: | |
publish-bookmarklet: | ||
name: Publish bookmarklet | ||
needs: | ||
- build | ||
- test | ||
- ember-try | ||
- build | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -148,3 +184,115 @@ jobs: | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
SOURCE_DIR: bookmarklet | ||
DEST_DIR: dist_bookmarklet | ||
|
||
publish-chrome: | ||
name: Publish Chrome extension | ||
needs: | ||
- test | ||
- ember-try | ||
- build | ||
if: >- | ||
github.event_name == 'schedule' || | ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Volta | ||
uses: rwjblue/setup-volta@v1 | ||
- name: Install dependencies (chrome-webstore-upload-cli) | ||
run: volta install chrome-webstore-upload-cli | ||
- name: Download artifacts (Chrome) | ||
uses: actions/download-artifact@master | ||
with: | ||
name: chrome | ||
- name: Upload to Chrome Web Store | ||
run: | | ||
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then | ||
EXTENSION_ID="ibdbkmdgflhglikhjdbogjjflkialpfi" | ||
else | ||
EXTENSION_ID="bmdblncegkenkacieihfhpjfppoconhi" | ||
fi | ||
webstore upload --source chrome --auto-publish | ||
env: | ||
CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | ||
CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | ||
REFRESH_TOKEN: ${{ secrets.GOOGLE_REFRESH_TOKEN }} | ||
|
||
publish-firefox: | ||
name: Publish Firefox extension | ||
needs: | ||
- test | ||
- ember-try | ||
- build | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Volta | ||
uses: rwjblue/setup-volta@v1 | ||
- name: Install dependencies (web-ext) | ||
run: | | ||
volta install web-ext | ||
# https://github.com/mozilla/web-ext/issues/804 | ||
volta install web-ext-submit | ||
- name: Download artifacts (Firefox) | ||
uses: actions/download-artifact@master | ||
with: | ||
name: firefox | ||
- name: Upload to AMO | ||
working-directory: firefox | ||
run: web-ext-submit --channel=listed | ||
env: | ||
WEB_EXT_API_KEY: ${{ secrets.FIREFOX_API_KEY }} | ||
WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} | ||
WEB_EXT_ID: [email protected] | ||
|
||
publish-npm: | ||
name: Publish npm package | ||
needs: | ||
- test | ||
- ember-try | ||
- build | ||
if: >- | ||
github.event_name == 'schedule' || | ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Volta | ||
uses: rwjblue/setup-volta@v1 | ||
- name: Set up NPM | ||
run: | | ||
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}"> ~/.npmrc | ||
npm whoami | ||
env: | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
- name: Download artifacts (npm) | ||
uses: actions/download-artifact@master | ||
with: | ||
name: npm | ||
- name: Publish to npm | ||
working-directory: npm | ||
run: | | ||
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then | ||
npm publish --tag alpha | ||
else | ||
npm publish | ||
fi | ||
publish-github: | ||
name: Publish GitHub release | ||
needs: | ||
- test | ||
- ember-try | ||
- build | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: false | ||
prerelease: false |
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