π Release new version #244
This file contains hidden or 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
name: π Release new version | |
on: | |
schedule: | |
- cron: "0 3 * * *" # Every day at 3:00 UTC | |
workflow_dispatch: | |
jobs: | |
preparation: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
actions: read | |
outputs: | |
status: ${{ steps.check.outputs.status }} | |
steps: | |
- name: π₯ Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
persist-credentials: false | |
- name: π¦ Install dependencies | |
run: npm ci | |
- name: π Fetch release version | |
run: | | |
release_version=$(npm view material-icon-theme version) | |
current_version=$(npm list material-icon-theme --depth=0 | grep 'material-icon-theme@' | cut -d '@' -f 2) | |
echo "release_version=$release_version" >> $GITHUB_ENV | |
echo "current_version=$current_version" >> $GITHUB_ENV | |
- name: β Check release conditions | |
id: check | |
run: | | |
status="skip" | |
if [ "$release_version" != "$current_version" ] || [ "$GITHUB_EVENT_NAME" != "schedule" ]; then | |
status="release" | |
fi | |
echo "status=$status" >> $GITHUB_OUTPUT | |
release: | |
runs-on: ubuntu-latest | |
needs: preparation | |
if: needs.preparation.outputs.status == 'release' | |
permissions: | |
contents: write | |
id-token: write | |
actions: write | |
steps: | |
- name: π€ Use App Token for the Bot which is allowed to create releases | |
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1 | |
id: app-token | |
with: | |
app-id: ${{ vars.BOT_APP_ID }} | |
private-key: ${{ secrets.BOT_PRIVATE_KEY }} | |
- name: π₯ Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.app-token.outputs.token }} | |
- name: π§ Configure Git | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
git config --global push.followTags true | |
- name: π¦ Install dependencies | |
run: npm ci | |
- name: π Attempt update and prepare release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm install [email protected] | |
npx changelogen --bump --hideAuthorEmail | |
npm run update-versions | |
- name: π Get metadata | |
run: | | |
VERSION=$(jq -r '.version' package.json) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: ποΈ Build extension | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npm run build | |
- name: π Commit and Tag Release | |
env: | |
# Don't run husky on `git commit` | |
HUSKY: 0 | |
run: | | |
git add package.json package-lock.json src/manifests/base.json CHANGELOG.md README.md | |
git commit -m "chore(release): v$VERSION" | |
git tag "v$VERSION" | |
git push origin --follow-tags | |
npx changelogen github release --token ${{ secrets.GITHUB_TOKEN }} | |
- name: π Upload to chrome store | |
continue-on-error: true | |
uses: trmcnvn/chrome-addon@7fc5a5ad3ff597dc64d6a13de7dcaa8515328be7 # v2 | |
with: | |
extension: bggfcpfjbdkhfhfmkjpbhnkhnpjjeomc | |
zip: github-material-icons-chrome-extension.zip | |
client-id: ${{ secrets.CHROME_CLIENT_ID }} | |
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }} | |
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }} | |
- name: π Upload to edge store | |
continue-on-error: true | |
uses: wdzeng/edge-addon@d4db1eea77297a24d799394dec87e8912e0902f9 # v2.1.0 | |
with: | |
product-id: f95e9c6a-6470-45a1-ae09-821d3b916923 | |
zip-path: github-material-icons-edge-extension.zip | |
client-id: ${{ secrets.EDGE_CLIENT_ID }} | |
api-key: ${{ secrets.EDGE_API_KEY }} | |
- name: π Upload to firefox store | |
continue-on-error: true | |
run: npx web-ext sign -s ./dist/firefox/ --channel=listed --api-key=${{ secrets.FIREFOX_API_JWT_ISSUER }} --api-secret=${{ secrets.FIREFOX_API_JWT_SECRET }} | |
- name: β¬οΈ Upload zip files to GitHub release | |
run: | | |
gh release upload v$VERSION github-material-icons-chrome-extension.zip github-material-icons-edge-extension.zip github-material-icons-firefox-extension.zip | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |