updated version number to 0.1.7 #35
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: | |
push: | |
tags: | |
- 'v*' | |
env: | |
PROJECT_NAME: 'tone' | |
PROJECT_PATH: 'tone/tone.csproj' | |
PROJECT_OUTPUT_PATH: ${{ github.workspace }}/output/ | |
DOTNET_VERSION: '6.0.405' | |
DOTNET_FRAMEWORK: 'net6.0' | |
jobs: | |
release: | |
name: Release | |
strategy: | |
matrix: | |
kind: [ | |
'linux', | |
'linux-musl-x64', | |
'linux-arm', | |
'linux-arm64', | |
'windows', | |
'macOS', | |
'macOS-arm' | |
] | |
include: | |
- kind: linux | |
os: ubuntu-latest | |
target: linux-x64 | |
- kind: linux-musl-x64 | |
os: ubuntu-latest | |
target: linux-musl-x64 # for docker | |
- kind: linux-arm | |
os: ubuntu-latest | |
target: linux-arm | |
- kind: linux-musl-arm | |
os: ubuntu-latest | |
target: linux-musl-arm | |
- kind: linux-arm64 | |
os: ubuntu-latest | |
target: linux-arm64 | |
- kind: linux-musl-arm64 | |
os: ubuntu-latest | |
target: linux-musl-arm64 | |
- kind: windows | |
os: windows-latest | |
target: win-x64 | |
- kind: macOS | |
os: macos-latest | |
target: osx-x64 | |
- kind: macOS-arm | |
os: macos-latest | |
target: osx-arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
source-url: "https://nuget.pkg.github.com/sandreas/index.json" | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Get version | |
id: version | |
uses: battila7/get-version-action@v2 | |
- name: Build | |
id: build | |
shell: bash | |
run: | | |
release_name="${{ env.PROJECT_NAME }}-${{ steps.version.outputs.version-without-v }}-${{ matrix.target }}" | |
release_notes="$(sed 's/%/%25/g;s/\r/%0D/g;' ${{ env.PROJECT_NAME }}/doc/release/release-notes-${{ steps.version.outputs.version }}.md | sed ':a;N;$!ba;s/\n/%0A/g')" | |
echo "::set-output name=release_notes::$release_notes" | |
sed -i.bak "s/<TargetFramework>net6.0<\/TargetFramework>/<TargetFramework>${{ env.DOTNET_FRAMEWORK }}<\/TargetFramework>/g" ${{ env.PROJECT_PATH }} | |
if [ "${{ matrix.target }}" == "osx-arm64" ]; then | |
dotnet publish ${{ env.PROJECT_PATH }} --framework ${{ env.DOTNET_FRAMEWORK }} --runtime "${{ matrix.target }}" -c Release -p:EnableCompressionInSingleFile=false -p:PublishSingleFile=true --self-contained true -p:PublishReadyToRun=true -p:PublishTrimmed=true -o "$release_name" | |
else | |
dotnet publish ${{ env.PROJECT_PATH }} --framework ${{ env.DOTNET_FRAMEWORK }} --runtime "${{ matrix.target }}" -c Release -p:PublishSingleFile=true --self-contained true -p:PublishReadyToRun=true -p:PublishTrimmed=true -o "$release_name" | |
fi | |
if [ "${{ matrix.target }}" == "win-x64" ]; then | |
7z a -tzip "${release_name}.zip" "./${release_name}/tone.exe" | |
else | |
tar czvf "${release_name}.tar.gz" "$release_name/tone" | |
fi | |
rm -r "$release_name" | |
- name: Publish | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: "${{ env.PROJECT_NAME }}-${{ steps.version.outputs.version-without-v }}-${{ matrix.target }}*" | |
body: "${{ steps.build.outputs.release_notes }}" | |
prerelease: endsWith(github.ref, 'prerelease') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
docker: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
file: tone/Dockerfile.release | |
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 | |
#platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x | |
push: true | |
tags: sandreas/tone:${{ github.ref_name }} | |
build-args: | | |
REF_NAME=${{ github.ref_name }} |