Skip to content

Commit

Permalink
refactor: separating into 2 workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo-COLLIN committed Jun 2, 2024
1 parent 236ddcb commit 1123916
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 129 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-and-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and Tag for Release

on:
push:
branches:
- publish

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install dependencies
run: npm install

- name: Build extension
run: npm run prod

- name: Prepare source code zip
run: zip -r releases/save-my-phind_${{ github.run_number }}_firefox_source.zip src/

- name: Get version from package.json
id: package_version
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"

- name: Create Tag
run: git tag v${{ steps.package_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push Tag
run: git push origin v${{ steps.package_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102 changes: 102 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Publish Release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n**Full Changelog:** #{{RELEASE_DIFF}}",
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in ##{{NUMBER}}",
"categories": [
{
"title": "## What's Changed"
}
]
}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.ref }}
release_name: ⏩ v${{ github.ref }}
body: ${{ steps.github_release.outputs.changelog }}
draft: false
prerelease: false

# - name: Download CRX and XPI files
# run: |
# wget -O releases/save-my-phind_${{ steps.package_version.outputs.version }}_chrome.crx "https://clients2.google.com/service/update2/crx?response=redirect&prodversion=90.0.4430.212&acceptformat=crx2,crx3&x=id%3Dagklnagmfeooogcppjccdnoallkhgkod%26uc"
#
# - name: Upload Release Asset Chrome CRX
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./releases/save-my-phind_${{ steps.package_version.outputs.version }}_chrome.crx
# asset_name: save-my-phind_${{ steps.package_version.outputs.version }}_chrome.crx
# asset_content_type: application/x-chrome-extension
#
# - name: Upload Release Asset Firefox XPI
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./releases/save-my-phind_${{ steps.package_version.outputs.version }}_firefox.xpi
# asset_name: save-my-phind_${{ steps.package_version.outputs.version }}_firefox.xpi
# asset_content_type: application/x-xpinstall

- name: Upload Release Asset Chrome
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./releases/save-my-phind_${{ github.ref_name }}_chrome.zip
asset_name: save-my-phind_${{ github.ref_name }}_chrome.zip
asset_content_type: application/zip

- name: Upload Release Asset Firefox
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./releases/save-my-phind_${{ github.ref_name }}_firefox.zip
asset_name: save-my-phind_${{ github.ref_name }}_firefox.zip
asset_content_type: application/zip

- name: Create a new GitHub Discussion
uses: abirismyname/[email protected]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: Release Discussion for v${{ github.ref_name }}
body: ${{ steps.github_release.outputs.changelog }}
repository-id: ${{ github.repository_id }}
category-id: Announcements


- name: Browser Platform Publish
uses: PlasmoHQ/[email protected]
with:
keys: ${{ secrets.BPP_KEYS }}
129 changes: 0 additions & 129 deletions .github/workflows/publish.yml

This file was deleted.

0 comments on commit 1123916

Please sign in to comment.