Merge pull request #18 from SugarF0x/master #40
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 flow | |
on: | |
push: | |
branches: | |
- release | |
paths-ignore: | |
- package.json | |
- CHANGELOG.md | |
env: | |
DIST_PATH: dist | |
RELEASE_PATH: output.zip | |
jobs: | |
setup: | |
name: Checkout & generate changelog | |
runs-on: ubuntu-latest | |
outputs: | |
clean_changelog: ${{ steps.changelog.outputs.clean_changelog }} | |
tag: ${{ steps.changelog.outputs.tag }} | |
skipped: ${{ steps.changelog.outputs.skipped }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: release | |
- name: Generate Changelog | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v3 | |
with: | |
git-message: 'chore(release): {version}' | |
release-count: 0 | |
build: | |
name: Build distributive | |
needs: [ setup ] | |
if: ${{ needs.setup.outputs.skipped == 'false' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: release | |
- name: Set up Node.js & yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'yarn' | |
- name: Install project dependencies | |
run: yarn --prefer-offline | |
- name: Install dependencies | |
run: yarn install | |
- name: Build | |
run: yarn build | |
- uses: montudor/action-zip@v1 | |
with: | |
args: zip -qq -r ${{ env.RELEASE_PATH }} ${{ env.DIST_PATH }} | |
- name: Upload deployment artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: ${{ env.DIST_PATH }} | |
retention-days: 3 | |
- name: Upload release artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release | |
path: ${{ env.RELEASE_PATH }} | |
retention-days: 3 | |
release: | |
name: Create release | |
needs: [ setup, build ] | |
if: ${{ needs.setup.outputs.skipped == 'false' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download release artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: release | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.setup.outputs.tag }} | |
name: ${{ needs.setup.outputs.tag }} | |
body: ${{ needs.setup.outputs.clean_changelog }} | |
files: ${{ env.RELEASE_PATH }} | |
publish: | |
name: Publish to chrome store | |
needs: [ setup, build ] | |
if: ${{ needs.setup.outputs.skipped == 'false' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download release artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: release | |
- name: Publish | |
uses: trmcnvn/chrome-addon@v2 | |
with: | |
zip: ${{ env.RELEASE_PATH }} | |
extension: ${{ secrets.CHROME_EXTENSION_ID }} | |
client-id: ${{ secrets.CHROME_CLIENT_ID }} | |
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }} | |
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }} |