Skip to content

Commit

Permalink
Automatically publish to Chrome, Firefox, NPM and GitHub (#1080)
Browse files Browse the repository at this point in the history
(cherry picked from commit 334e387)
  • Loading branch information
chancancode committed Nov 13, 2019
1 parent bcdd302 commit fcd6979
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 43 deletions.
150 changes: 149 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
57 changes: 15 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,55 +84,28 @@ Run `yarn install && yarn global add ember-cli to install the required modules.
Patch versions are only committed to the stable branch. So we need to cherry-pick the commits we need from master and bump stable to the new patch version.

- `git checkout stable`
- Cherry-pick the needed commits from master to stable
- Bump the patch version in `package.json`. Add the change log entry and commit.
- Follow the "Steps to publish" below.
- `git checkout master`
- Commit the change log entry to the master branch.
- Cherry-pick the needed commits from master to stable.
- Add the change log entry and commit. We use [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator) for this.
You will want to follow the installation instructions on their README, and take note that you will need to provide a GitHub token.
Once installed, and you add a token, you can run `yarn changelog` in your terminal.
- `yarn version --patch`
- `git push --tags`
- `git push`
- PR the change log entry to the master branch.

#### Minor and major versions

When releasing a major/minor version, master would already have this version set, so what we need to do is to merge master into stable and release.

- Add the new minor/major version's change log entry in `CHANGELOG.md` and commit to master. We use [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator)
for this. You will want to follow the installation instructions on their README, and take note that you will need to provide a GitHub token.
Once installed, and you add a token, you can run `yarn changelog` in your terminal.
- `git checkout stable`
- `git merge -X theirs master`
- Follow the "Steps to publish" steps below.
- `git checkout master`
- Update `package.json` to the future major/minor version.

#### Steps to publish

- Push the `stable` branch to github (this will publish the bookmarklet version).
- `yarn build:production`
- `git tag` the new version
- Follow the "Publishing to Chrome" steps
- Follow the "Publishing to Firefox" steps
- `npm publish ./`

##### Publishing to Chrome

- Make sure you have the correct credentials to publish to Chrome.
- Sign in to the [Chrome Webstore](https://chrome.google.com/webstore)
- Click on Settings -> Developer dashboard
- Click on "Edit" next to "Ember Inspector"
- Click on Upload Updated Package
- Click on "Choose file"
- Choose the file `dist/chrome/ember-inspector.zip`
- Click "Upload"
- Click "Save and publish changes"

##### Publishing to Firefox

- Make sure you have the correct credentials to publish to Firefox.
- Sign in to the [Mozilla Addons Site](https://addons.mozilla.org)
- Click on Tools -> Manage My Submissions
- Click on "New Version" below "Ember Inspector"
- Click on "Select a file"
- Choose the file `dist/firefox/ember-inspector.zip`
- Follow the steps to publish
- Add the change log entry and commit. We use [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator) for this.
You will want to follow the installation instructions on their README, and take note that you will need to provide a GitHub token.
Once installed, and you add a token, you can run `yarn changelog` in your terminal.
- `yarn version` (keep the same version number)
- `git push --tags`
- `git push`
- PR the change log entry to the master branch, as well as increment `package.json` to the next major/minor version.

### Locking a version

Expand Down

0 comments on commit fcd6979

Please sign in to comment.