Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/release workflow #2

Merged
merged 26 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
description: "The version of the addon to build"
type: string
required: false
outputs:
VERSION:
description: "The version of the addon to build"
value: ${{ jobs.build-artifact.outputs.VERSION }}

push:
branches:
- main
Expand All @@ -31,6 +36,9 @@ jobs:
name: "Build TapToQR Artifact"
runs-on: ubuntu-latest

outputs:
VERSION: ${{ steps.determine-version.outputs.VERSION }}

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
158 changes: 157 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: "Release TapToQR"
on:
workflow_dispatch:
inputs:
skip-update:
type: boolean
description: "Skip the version update step"
required: true
default: false
release-type:
type: choice
description: Which type of release to create?
Expand All @@ -12,6 +17,26 @@ on:
- patch
- minor
- major
publish-firefox:
type: boolean
description: Should the Firefox Addon be published?
required: true
default: true
publish-chrome:
type: boolean
description: Should the Chrome Extension be published?
required: true
default: true
publish-edge:
type: boolean
description: Should the Edge Extension be published?
required: true
default: true
publish-github:
type: boolean
description: Should the Github Release be published?
required: true
default: true

concurrency:
group: ${{ github.workflow }}
Expand All @@ -20,11 +45,15 @@ concurrency:
jobs:
# Get the Current Version and Bump it depending on the release-type input
update-version:
name: "Update TapToQR Version"
runs-on: ubuntu-latest
permissions: write-all
outputs:
new_version: ${{ steps.bump_version.outputs.new_version }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Ensure branch is main
if: github.ref != 'refs/heads/main'
run: |
Expand All @@ -38,6 +67,7 @@ jobs:

- name: Bump version
id: bump_version
if: ${{ github.event.inputs.skip-update == 'false' }}
run: |
# Retrieve the increment type from the GitHub Actions input
increment="${{ inputs.release-type }}"
Expand Down Expand Up @@ -81,7 +111,133 @@ jobs:

- name: Update version var
id: write_version
if: ${{ github.event.inputs.skip-update == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.VAR_UPDATE_GITHUB }}
run: |
gh variable set VERSION --body "${{ steps.bump_version.outputs.new_version }}"

build:
uses: ./.github/workflows/build.yml
with:
VERSION: ${{ needs.update-version.outputs.new_version }}
needs:
[
update-version
]

release-github:
runs-on: ubuntu-latest
name: "Create TapToQR Github Release"
if: ${{ github.event.inputs.publish-github == 'true' }}
permissions: write-all
needs:
[
build
]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download Artifact
uses: actions/download-artifact@v4

- name: Create Release
working-directory: './TapToQR-addon'
env:
GH_TOKEN: ${{github.token}}
run: |
echo "Creating release v${{needs.build.outputs.VERSION}}"
gh release create v${{needs.build.outputs.VERSION}} --generate-notes
gh release upload v${{needs.build.outputs.VERSION}} TapToQR-${{needs.build.outputs.VERSION}}.zip

release-firefox:
runs-on: ubuntu-latest
name: "Create TapToQR Firefox Release"
if: ${{ github.event.inputs.publish-firefox == 'true' }}
needs:
[
build
]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download Artifact
uses: actions/download-artifact@v4

- uses: wdzeng/firefox-addon@1c933bcfc899dad45719bc23ec8c607d51bf8c06
name: "Upload to Firefox Addon Store"
with:
addon-guid: "[email protected]"
xpi-path: TapToQR-addon/TapToQR-${{needs.build.outputs.VERSION}}.zip
self-hosted: false
jwt-issuer: ${{ secrets.FIREFOX_JWT_ISSUER }}
jwt-secret: ${{ secrets.FIREFOX_JWT_SECRET }}

release-chrome:
runs-on: ubuntu-latest
name: "Create TapToQR Chrome Release"
if: ${{ github.event.inputs.publish-chrome == 'true' }}
needs:
[
build
]

env:
EXTENSION_ID: "ommdikomjapdndpedljobeecepeopjmp"
CLIENT_ID: ${{ secrets.CI_GOOGLE_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CI_GOOGLE_CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download Artifact
uses: actions/download-artifact@v4

- name: "Setup Google Webstore CLI"
run: |
npm install -g chrome-webstore-upload-cli

- name: "Upload to Chrome Webstore"
run: |-
cd TapToQR-addon

unzip TapToQR-${{needs.build.outputs.VERSION}}.zip
rm TapToQR-${{needs.build.outputs.VERSION}}.zip

chrome-webstore-upload

release-edge:
runs-on: ubuntu-latest
name: "Create TapToQR Edge Release"
if: ${{ github.event.inputs.publish-edge == 'true' }}
needs:
[
build
]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download Artifact
uses: actions/download-artifact@v4

- name: Prepare Artifact
run: |
cd TapToQR-addon
unzip TapToQR-${{needs.build.outputs.VERSION}}.zip
rm TapToQR-${{needs.build.outputs.VERSION}}.zip
FILE="manifest.json"
jq 'del(.browser_specific_settings)' "$FILE" > temp_manifest.json && mv temp_manifest.json "$FILE"
# zip again
zip -r TapToQR-${{needs.build.outputs.VERSION}}.zip ./*

- uses: wdzeng/edge-addon@d4db1eea77297a24d799394dec87e8912e0902f9
with:
product-id: "1cc708c2-05e8-4339-9fdb-ddca04acf678"
zip-path: TapToQR-addon/TapToQR-${{needs.build.outputs.VERSION}}.zip
api-key: ${{ secrets.MICROSOFT_API_KEY }}
client-id: ${{ secrets.MICROSOFT_CLIENT_ID }}
2 changes: 1 addition & 1 deletion addon/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "TapToQR",
"version": "1.1.0",
"version": "0.0.0",
"description": "Instantly generate and share a QR code for the webpage you're currently viewing, making link sharing seamless and quick.",
"author": "Moritz Reis",
"icons": {
Expand Down
Loading