Create Release #80
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
name: Release & Deploy | |
on: | |
schedule: | |
- cron: '30 0 * * *' | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Semver Info | |
id: semver | |
uses: cdrani/action-semantic-release-info@fix/current-branch | |
- name: Update Version | |
if: steps.semver.outputs.version != '' | |
run: | | |
# Package | |
jq --arg version "${{ steps.semver.outputs.version }}" \ | |
'.version = $version' package.json > tmp && \ | |
mv tmp package.json | |
# Chrome | |
jq --arg version "${{ steps.semver.outputs.version }}" \ | |
'.version = $version' src/manifest.chrome.json > tmp && \ | |
mv tmp src/manifest.chrome.json | |
# Firefox | |
jq --arg version "${{ steps.semver.outputs.version }}" \ | |
'.version = $version' src/manifest.firefox.json > tmp && \ | |
mv tmp src/manifest.firefox.json | |
- name: Commit Changes | |
if: steps.semver.outputs.version != '' | |
run: | | |
git config --local user.name "Github Action" | |
git config user.email "[email protected]" | |
git diff --quiet || git commit -a -m "docs: bump version to ${{ steps.semver.outputs.git_tag }}" | |
git tag ${{ steps.semver.outputs.git_tag }} | |
- name: Push Changes | |
if: steps.semver.outputs.version != '' | |
uses: ad-m/github-push-action@master | |
with: | |
branch: ${{ github.ref }} | |
tags: true | |
- name: Nightly Merge | |
if: steps.semver.outputs.version != '' | |
uses: robotology/[email protected] | |
with: | |
allow_ff: true | |
ff_only: true | |
stable_branch: 'main' | |
development_branch: 'develop' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Archive Extension Files | |
if: steps.semver.outputs.version != '' | |
run: | | |
# Chrome Zip | |
cp -r src chrome_temp | |
rm chrome_temp/manifest.firefox.json | |
mv chrome_temp/manifest.chrome.json chrome_temp/manifest.json | |
zip -r chorus-chrome.zip chrome_temp/ | |
rm -rf chrome_temp/ | |
# Firefox Zip | |
cp -r src firefox_temp | |
rm firefox_temp/manifest.chrome.json | |
mv firefox_temp/manifest.firefox.json firefox_temp/manifest.json | |
zip -r chorus-firefox.zip firefox_temp/ | |
rm -rf firefox_temp/ | |
- name: Create Release Archive & Notes | |
if: steps.semver.outputs.version != '' | |
uses: ncipollo/[email protected] | |
with: | |
tag: ${{ steps.semver.outputs.git_tag }} | |
name: ${{ steps.semver.outputs.git_tag }} | |
body: ${{ steps.semver.outputs.notes }} | |
artifacts: 'chorus-chrome.zip,chorus-firefox.zip' | |
- name: Upload & Publish | |
if: steps.semver.outputs.version != '' | |
uses: cdrani/chrome-extension-upload@ci/silent-update-fail | |
with: | |
silent-fail: true | |
file-path: chorus-chrome.zip | |
client-id: ${{ secrets.CLIENT_ID }} | |
extension-id: ${{ secrets.EXTENSION_ID }} | |
client-secret: ${{ secrets.CLIENT_SECRET }} | |
refresh-token: ${{ secrets.REFRESH_TOKEN }} |