Release #55
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: Release | |
on: | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
defaults: | |
run: | |
working-directory: src | |
jobs: | |
init: | |
name: Initialize | |
runs-on: ubuntu-latest | |
outputs: | |
product-version: ${{ steps.version.outputs.product-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Version | |
id: version | |
working-directory: ./ | |
run: | | |
productVersion=$(cat version.txt) | |
majorVersion=$(echo "$productVersion" | cut -d'.' -f1) | |
echo "product-version=$productVersion" >> $GITHUB_OUTPUT | |
echo "product-version-major=$majorVersion" >> $GITHUB_OUTPUT | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
needs: init | |
steps: | |
- name: Publish | |
run: | | |
echo "hi: ${{ needs.init.outputs.product-version }}" | |
echo "yo: ${{ needs.init.outputs.product-version-major }}" | |
exe: | |
name: Build executables | |
runs-on: ubuntu-latest | |
needs: init | |
strategy: | |
matrix: | |
rid: | |
- win-x64 | |
- win-arm64 | |
- osx-x64 | |
- osx-arm64 | |
- linux-x64 | |
- linux-arm64 | |
- linux-musl-x64 | |
- linux-musl-arm64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "8.0.x" | |
- name: Install dependencies | |
working-directory: src/Valleysoft.Dredge | |
run: dotnet restore --runtime ${{ matrix.rid }} | |
- name: Publish | |
working-directory: src/Valleysoft.Dredge | |
run: dotnet publish -f net8.0 -c Release --no-restore -o ${{ github.workspace }}/publish --runtime ${{ matrix.rid }} | |
- name: Rename output | |
run: | | |
if [[ "${{ matrix.rid }}" == *"win"* ]]; then | |
dredgeExt=".exe" | |
else | |
dredgeExt="" | |
fi | |
exeName="dredge-${{ needs.init.outputs.product-version }}-${{ matrix.rid }}${dredgeExt}" | |
echo "EXE_NAME=${exeName}" >> $GITHUB_ENV | |
mv ${{ github.workspace }}/publish/dredge${dredgeExt} ${{ github.workspace }}/publish/${exeName} | |
rm ${{ github.workspace }}/publish/dredge.pdb | |
- name: Generate checksum | |
run: sha256sum ${EXE_NAME} >${EXE_NAME}.sha256sum | |
working-directory: ${{ github.workspace }}/publish | |
- name: Save build binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dredge-binaries-${{ matrix.rid }} | |
path: ${{ github.workspace }}/publish | |
save-exes: | |
name: Save executables | |
needs: exe | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download build binaries | |
uses: actions/download-artifact@v3 | |
with: | |
path: ${{ github.workspace }}/publish | |
- name: Move all files | |
run: | | |
mv ${{ github.workspace }}/publish/dredge-binaries-*/* ${{ github.workspace }}/publish | |
rm -r ${{ github.workspace }}/publish/dredge-binaries-* | |
- name: Save build binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dredge-binaries | |
path: ${{ github.workspace }}/publish | |
nuget: | |
name: Publish NuGet Package | |
runs-on: ubuntu-latest | |
needs: save-exes | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "8.0.x" | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c Release --no-restore Valleysoft.Dredge | |
- name: Pack | |
env: | |
PACKAGE_VERSION: ${{ needs.init.outputs.product-version }} | |
run: dotnet pack -c Release -p:Version=$PACKAGE_VERSION Valleysoft.Dredge -p:IsPack=true | |
# - name: Publish Package | |
# run: dotnet nuget push "Valleysoft.Dredge/bin/Release/*.nupkg" -k ${{secrets.NUGET_ORG_API_KEY}} -s https://nuget.org | |
docker: | |
name: Publish Docker Image | |
runs-on: ubuntu-latest | |
needs: nuget | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./src | |
platforms: linux/amd64,linux/arm64 | |
push: false | |
tags: > | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.init.outputs.product-version }}, | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.init.outputs.product-version-major }}, | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
build-args: | | |
PACKAGE_VERSION=${{ needs.init.outputs.product-version }} |