Skip to content

add release plan

add release plan #3

Workflow file for this run

# For every push to the master branch, this checks if the release-plan was
# updated and if it was it will publish stable npm packages based on the
# release plan
name: Publish Stable
on:
pull_request: {}
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
concurrency:
group: publish-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
check-plan:
name: "Check Release Plan"
runs-on: ubuntu-latest
outputs:
command: ${{ steps.check-release.outputs.command }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
# This will only cause the `check-plan` job to have a result of `success`
# when the .release-plan.json file was changed on the last commit. This
# plus the fact that this action only runs on main will be enough of a guard
- id: check-release
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
build:
name: Build extensions
runs-on: ubuntu-latest
env:
CI: 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup pnpm & node
uses: wyvox/action-setup-pnpm@v3
- name: Install dependencies (pnpm)
run: pnpm install
- name: Download panes
run: node scripts/download-panes.js
env:
EMBER_ENV: production
- name: Update manifest.json (nightly)
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 manifest.json (pull request)
if: github.event_name == 'pull_request'
run: |
SHA="${SHA:0:7}"
CONTENT="$(cat "$FILE")"
echo "$CONTENT" | jq --arg pr "$PR" --arg sha "$SHA" "$FILTER" > $FILE
cat "$FILE"
env:
FILE: skeletons/web-extension/manifest.json
FILTER: >-
.name += " (PR #\($pr))" |
.version = $pr |
.version_name = $sha
PR: ${{ github.event.pull_request.number }}
SHA: ${{ github.event.pull_request.head.sha }}
- name: Update package.json (nightly)
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: Update package.json (pull request)
if: github.event_name == 'pull_request'
run: |
SHA="${SHA:0:7}"
CONTENT="$(cat "$FILE")"
echo "$CONTENT" | jq --arg pr "$PR" --arg sha "$SHA" "$FILTER" > $FILE
cat "$FILE"
env:
FILE: package.json
FILTER: .version += "-alpha.0.\($pr)+\($sha)"
PR: ${{ github.event.pull_request.number }}
SHA: ${{ github.event.pull_request.head.sha }}
- name: Set EMBER_INSPECTOR_TAB (nightly)
if: github.event_name == 'schedule'
run: echo "EMBER_INSPECTOR_TAB=Nightly" >> $GITHUB_ENV
- name: Set EMBER_INSPECTOR_TAB (pull request)
if: github.event_name == 'pull_request'
run: echo "EMBER_INSPECTOR_TAB=PR \#$PR" >> $GITHUB_ENV
env:
PR: ${{ github.event.pull_request.number }}
- name: Build
run: pnpm ember build --environment production
- name: Pack
run: |
VERSION="$(jq -r '.version' package.json)"
pnpm pack
mkdir -p dist/npm
tar xvzf "ember-inspector-$VERSION.tgz" -C dist/npm --strip-components 1
- name: Upload artifacts (bookmarklet)
uses: actions/upload-artifact@v4
with:
name: bookmarklet
path: dist/bookmarklet
- name: Upload artifacts (Chrome)
uses: actions/upload-artifact@v4
with:
name: chrome
path: dist/chrome
- name: Upload artifacts (Firefox)
uses: actions/upload-artifact@v4
with:
name: firefox
path: dist/firefox
- name: Upload artifacts (npm)
uses: actions/upload-artifact@v4
with:
name: npm
path: dist/npm
publish-bookmarklet:
name: Publish bookmarklet
needs:
- check-plan
- build
runs-on: ubuntu-latest
steps:
- name: Download artifacts (bookmarklet)
uses: actions/download-artifact@v4
with:
name: bookmarklet
path: bookmarklet
- name: Upload to S3
if: needs.check-plan.outputs.command == 'release'
uses: jakejarvis/[email protected]
with:
args: --acl public-read --cache-control "max-age=86400000,public"
env:
AWS_S3_BUCKET: ember-extension
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: bookmarklet
DEST_DIR: dist_bookmarklet
publish-chrome:
name: Publish Chrome extension
needs:
- check-plan
- build
runs-on: ubuntu-latest
steps:
- name: Set up node
uses: actions/setup-node@v4
- name: Install dependencies (chrome-webstore-upload-cli)
run: npm install -g chrome-webstore-upload-cli
- name: Download artifacts (Chrome)
uses: actions/download-artifact@v4
with:
name: chrome
path: chrome
- name: Set Environment Variables
run: |
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
echo "EXTENSION_ID=ibdbkmdgflhglikhjdbogjjflkialpfi" >> $GITHUB_ENV
echo "CLIENT_ID=${{ secrets.GOOGLE_NIGHTLY_CLIENT_ID }}" >> $GITHUB_ENV
echo "REFRESH_TOKEN=${{ secrets.GOOGLE_NIGHTLY_REFRESH_TOKEN }}" >> $GITHUB_ENV
else
echo "EXTENSION_ID=bmdblncegkenkacieihfhpjfppoconhi" >> $GITHUB_ENV
echo "CLIENT_ID=${{ secrets.GOOGLE_NIGHTLY_CLIENT_ID }}" >> $GITHUB_ENV
echo "REFRESH_TOKEN=${{ secrets.GOOGLE_NIGHTLY_REFRESH_TOKEN }}" >> $GITHUB_ENV
fi
- name: Upload to Chrome Web Store
if: >-
github.event_name == 'schedule' ||
needs.check-plan.outputs.command == 'release'
run: chrome-webstore-upload upload --source chrome --auto-publish
publish-firefox:
name: Publish Firefox extension
needs:
- check-plan
- build
runs-on: ubuntu-latest
steps:
- name: Set up nod
uses: actions/setup-node@v4
- name: Install dependencies (web-ext)
run: |
npm install -g web-ext
# https://github.com/mozilla/web-ext/issues/804
npm install -g web-ext-submit
- name: Download artifacts (Firefox)
uses: actions/download-artifact@v4
with:
name: firefox
path: firefox
- name: Upload to AMO
if: needs.check-plan.outputs.command == 'release'
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 }}
publish-npm:
name: Publish npm package
needs:
- check-plan
- build
runs-on: ubuntu-latest
steps:
- name: Set up node
uses: actions/setup-node@v4
- name: Download artifacts (npm)
uses: actions/download-artifact@v4
with:
name: npm
path: npm
- name: Publish to npm
if: >-
github.event_name == 'schedule' ||
needs.check-plan.outputs.command == 'release'
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
working-directory: npm
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}"> ~/.npmrc
npm whoami
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
pnpm publish --tag alpha
else
pnpm release-plan publish --singlePackage=ember-inspector
fi