Skip to content

Commit

Permalink
upload restic binary executables as artifacts
Browse files Browse the repository at this point in the history
- also include the github ref name in the artifact name
- run matrix on tag pushes as well
  • Loading branch information
emuell committed Jul 19, 2023
1 parent 8ce1b31 commit 8bead8a
Showing 1 changed file with 43 additions and 14 deletions.
57 changes: 43 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,54 @@
name: Build Matrix

on:
# run for all pull requests that should go into the master
pull_request:
branches:
- master
# allows to run the workflow manually from the actions tab
# 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:
tag_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",
artifact: "Windows.tar.gz",
executable_name: "Restic-Browser.exe",
os: windows-2022,
build_tags: "production,desktop",
build_platform: "windows/amd64",
}
- {
name: "Ubuntu",
artifact: "Linux.tar.gz",
executable_name: "restic-browser",
executable_name: "Restic-Browser",
os: ubuntu-20.04,
build_tags: "production,desktop",
build_platform: "linux/amd64",
}
- {
name: "macOS",
artifact: "macOS.tar.gz",
executable_name: "restic-browser.app",
os: macos-11,
build_tags: "production,desktop",
Expand Down Expand Up @@ -114,17 +129,31 @@ jobs:
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/${{ matrix.config.executable_name }}
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: Archive
uses: thedoctor0/zip-release@main
- name: Upload Artifact (Linux)
if: ${{ matrix.config.name == 'Ubuntu' }}
uses: actions/upload-artifact@v3
with:
type: tar
directory: build
path: bin
filename: ${{ matrix.config.artifact }}
name: "Restic-Browser-${{ needs.variables.outputs.ref_name }}-linux"
path: ./build/bin/${{ matrix.config.executable_name }}.tar
if-no-files-found: error

- name: Upload
- name: Upload Artifact (macOS)
if: ${{ matrix.config.name == 'macOS' }}
uses: actions/upload-artifact@v3
with:
path: build/${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
name: "Restic-Browser-${{ needs.variables.outputs.ref_name }}-macOS"
path: ./build/bin/${{ matrix.config.executable_name }}
if-no-files-found: error

0 comments on commit 8bead8a

Please sign in to comment.