Allow passing path to restic as argument #90
Workflow file for this run
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: Build Matrix | |
on: | |
# run for all pull requests that should go into the master | |
pull_request: | |
branches: | |
- master | |
# run when a new semantic version tag got pushed (a release) | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+(-[a-z]+)?' | |
# allow to run the workflow manually from the actions tab | |
workflow_dispatch: | |
jobs: | |
variables: | |
outputs: | |
ref_name: ${{ steps.var.outputs.ref_name}} | |
runs-on: "ubuntu-20.04" | |
steps: | |
- name: Setting Global Variables | |
uses: actions/github-script@v6 | |
id: var | |
with: | |
script: | | |
core.setOutput('ref_name', '${{ github.ref_name }}'.toLowerCase().replaceAll(/[/\\*?]/g, '_').trim()); | |
build: | |
name: ${{ matrix.config.name }} | |
needs: [variables] | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows", | |
executable_name: "Restic-Browser.exe", | |
os: windows-2022, | |
build_tags: "production,desktop", | |
build_platform: "windows/amd64", | |
} | |
- { | |
name: "Ubuntu", | |
executable_name: "Restic-Browser", | |
os: ubuntu-20.04, | |
build_tags: "production,desktop", | |
build_platform: "linux/amd64", | |
} | |
- { | |
name: "macOS", | |
executable_name: "restic-browser.app", | |
os: macos-11, | |
build_tags: "production,desktop", | |
build_platform: "darwin/universal", | |
} | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '>=1.18.0' | |
- name: Setup NPM | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.4.x | |
- name: Setup Webkit (Linux) | |
run: sudo apt update && sudo apt install -y libgtk-3-dev libwebkit2gtk-4.0-dev | |
if: ${{ matrix.config.name == 'Ubuntu' }} | |
- name: Setup jq (macOS) | |
uses: dcarbone/install-jq-action@v1.0.1 | |
if: ${{ matrix.config.name == 'macOS' }} | |
- name: Setup Restic | |
uses: AnimMouse/setup-restic@v1 | |
- name: Setup Wails | |
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.4.1 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Test | |
run: go test ./backend/... | |
- name: Build | |
run: wails build -tags ${{ matrix.config.build_tags }} -platform ${{ matrix.config.build_platform }} | |
- name: Code Sign (Windows) | |
env: | |
WINDOWS_CODE_CERT_DATA: ${{ secrets.WINDOWS_CODE_CERT_DATA }} | |
WINDOWS_CODE_CERT_PASS: ${{ secrets.WINDOWS_CODE_CERT_PASS }} | |
if: ${{ matrix.config.name == 'Windows' && env.WINDOWS_CODE_CERT_DATA != null && env.WINDOWS_CODE_CERT_PASS != null }} | |
uses: lando/code-sign-action@v2 | |
with: | |
file: build/bin/${{ matrix.config.executable_name }} | |
certificate-data: ${{ secrets.WINDOWS_CODE_CERT_DATA }} | |
certificate-password: ${{ secrets.WINDOWS_CODE_CERT_PASS }} | |
- name: Code Sign (macOS) | |
env: | |
MACOS_CODE_CERT_DATA: ${{ secrets.MACOS_CODE_CERT_DATA }} | |
MACOS_CODE_CERT_PASS: ${{ secrets.MACOS_CODE_CERT_PASS }} | |
MACOS_CODE_CERT_TEAM_ID: ${{ secrets.MACOS_CODE_CERT_TEAM_ID }} | |
MACOS_EXECUTABLE_PATH: ./build/bin/${{ matrix.config.executable_name }} | |
if: ${{ matrix.config.name == 'macOS' && env.MACOS_CODE_CERT_DATA != null && env.MACOS_CODE_CERT_PASS != null && env.MACOS_CODE_CERT_TEAM_ID != null }} | |
run: | | |
echo $MACOS_CODE_CERT_DATA | base64 --decode > certificate.p12 | |
security create-keychain -p $MACOS_CODE_CERT_PASS build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p $MACOS_CODE_CERT_PASS build.keychain | |
security import certificate.p12 -k build.keychain -P $MACOS_CODE_CERT_PASS -T /usr/bin/codesign | |
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CODE_CERT_PASS build.keychain | |
/usr/bin/codesign --force -s $MACOS_CODE_CERT_TEAM_ID --deep --options=runtime "$MACOS_EXECUTABLE_PATH" | |
- name: Notarize (macOS) | |
env: | |
MACOS_NOTARY_USER: ${{ secrets.MACOS_NOTARY_USER }} | |
MACOS_NOTARY_PASS: ${{ secrets.MACOS_NOTARY_PASS }} | |
if: ${{ matrix.config.name == 'macOS' && env.MACOS_NOTARY_USER != null && env.MACOS_NOTARY_USER != null }} | |
uses: lando/notarize-action@v2 | |
with: | |
appstore-connect-username: ${{ secrets.MACOS_NOTARY_USER }} | |
appstore-connect-password: ${{ secrets.MACOS_NOTARY_PASS }} | |
appstore-connect-team-id: ${{ secrets.MACOS_CODE_CERT_TEAM_ID }} | |
primary-bundle-id: com.wails.restic-browser | |
product-path: ./build/bin/${{ matrix.config.executable_name }} | |
verbose: false | |
- name: Upload Artifact (Windows) | |
if: ${{ matrix.config.name == 'Windows' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "Restic-Browser-${{ needs.variables.outputs.ref_name }}-windows" | |
path: ./build/bin/*.exe | |
if-no-files-found: error | |
- name: Prepare Upload Artifact (Linux) | |
if: ${{ matrix.config.name == 'Ubuntu' }} | |
run: cd ./build/bin && tar -cvf ${{ matrix.config.executable_name }}.tar ${{ matrix.config.executable_name }} | |
- name: Upload Artifact (Linux) | |
if: ${{ matrix.config.name == 'Ubuntu' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "Restic-Browser-${{ needs.variables.outputs.ref_name }}-linux" | |
path: ./build/bin/*.tar | |
if-no-files-found: error | |
- name: Upload Artifact (macOS) | |
if: ${{ matrix.config.name == 'macOS' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "Restic-Browser-${{ needs.variables.outputs.ref_name }}-macOS" | |
path: ./build/bin/*.app | |
if-no-files-found: error |