Skip to content

Commit

Permalink
add release tag CI (#17)
Browse files Browse the repository at this point in the history
Build binaries when we make a release tag, and publish those on a github release.

This will let people without github accounts download and use the CLI, currently workflow artifacts are only available to logged-in users: actions/upload-artifact#51

Also fixes a bug in the binary CI to actually make one-file binaries instead of 256 `dll`s.
  • Loading branch information
ryepup authored Apr 23, 2021
1 parent a7df5aa commit 24def10
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 24 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,3 @@ jobs:
project_path: ${{ env.SLN }}
set_check_status_from_test_outcome: true
github_token: ${{ secrets.GITHUB_TOKEN }}
binaries:
needs: build
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
name: create standalone binaries
strategy:
matrix:
rid:
- win-x64
- linux-x64
- osx-x64
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "5.0.x"
- name: Create the self-contained binary
run: dotnet build --configuration Release "${APP}" -r ${{ matrix.rid }} -o out/${{ matrix.rid }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.rid }} binary
path: out/${{ matrix.rid }}/*
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release

on:
push:
tags:
- "v*"

env:
APP: "./src/XlsxCompare"

jobs:
verify_commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Verify commit exists in origin/main
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main
binaries:
needs: verify_commit
runs-on: ubuntu-latest
name: create standalone binaries
strategy:
matrix:
rid:
- win-x64
- linux-x64
- osx-x64
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "5.0.x"
- name: Create the self-contained binary
run: dotnet publish --configuration Release "${APP}" -r ${{ matrix.rid }} -o out/${{ matrix.rid }} --self-contained true
- name: rename so the release can have a flat list of files
run: cp out/${{ matrix.rid }}/XlsxCompare XlsxCompare-${{ matrix.rid }} || cp out/${{ matrix.rid }}/XlsxCompare.exe XlsxCompare-${{ matrix.rid }}.exe
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.rid }} binary
path: XlsxCompare*

release:
needs: binaries
runs-on: ubuntu-latest
steps:
- name: download all binaries
uses: actions/download-artifact@v2
- uses: "marvinpinto/[email protected]"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
**/XlsxCompare*
1 change: 0 additions & 1 deletion src/XlsxCompare/XlsxCompare.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<PublishTrimmed>true</PublishTrimmed>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<DebugType>embedded</DebugType>
Expand Down

0 comments on commit 24def10

Please sign in to comment.