mirror of
https://github.com/g3rv4/GetMoarFediverse.git
synced 2024-11-22 07:33:20 +01:00
97 lines
3.2 KiB
YAML
97 lines
3.2 KiB
YAML
name: Create Release
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
jobs:
|
|
create-artifact:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
runtime: [ win-x64, linux-x64, linux-arm64, osx-x64 ]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Build artifact
|
|
shell: pwsh
|
|
run: |
|
|
$tag = '${{ github.event.ref }}'.Replace('refs/tags/', '')
|
|
$zipDirectory = "GetMoarFediverse-$($tag)"
|
|
|
|
mkdir $tag
|
|
mkdir artifact
|
|
$outputPath = Join-Path (Pwd) $zipDirectory
|
|
$srcPath = Join-Path (Pwd) src
|
|
|
|
$uid = sh -c 'id -u'
|
|
$gid = sh -c 'id -g'
|
|
|
|
docker run -v "$($outputPath):/var/output" -v "$($srcPath):/var/src" mcr.microsoft.com/dotnet/sdk:6.0.403-alpine3.16 ash -c "dotnet publish -r ${{ matrix.runtime }} --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -c Release /var/src/GetMoarFediverse.csproj -o /var/output && chown -R $($uid):$($gid) /var/output"
|
|
|
|
Push-Location $outputPath
|
|
chmod +r *
|
|
chmod +x GetMoarFediverse || true
|
|
Pop-Location
|
|
|
|
if ('${{ matrix.runtime }}'.StartsWith('win-')) {
|
|
Compress-Archive -Path $zipDirectory -DestinationPath "artifact/GetMoarFediverse_${{ matrix.runtime }}.zip"
|
|
} else {
|
|
tar -czf artifact/GetMoarFediverse_${{ matrix.runtime }}.tgz $zipDirectory
|
|
}
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ matrix.runtime }}
|
|
path: artifact/*
|
|
|
|
create-release:
|
|
runs-on: ubuntu-latest
|
|
needs: [ create-artifact ]
|
|
steps:
|
|
- uses: actions/download-artifact@master
|
|
with:
|
|
name: win-x64
|
|
path: artifacts/win-x64
|
|
- uses: actions/download-artifact@master
|
|
with:
|
|
name: linux-x64
|
|
path: artifacts/linux-x64
|
|
- uses: actions/download-artifact@master
|
|
with:
|
|
name: linux-arm64
|
|
path: artifacts/linux-arm64
|
|
- uses: actions/download-artifact@master
|
|
with:
|
|
name: osx-x64
|
|
path: artifacts/osx-x64
|
|
- name: Release
|
|
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
|
|
with:
|
|
generate_release_notes: true
|
|
fail_on_unmatched_files: true
|
|
files: |
|
|
artifacts/win-x64/*.zip
|
|
artifacts/linux-x64/*.tgz
|
|
artifacts/linux-arm64/*.tgz
|
|
artifacts/osx-x64/*.tgz
|
|
|
|
create-docker-image:
|
|
runs-on: ubuntu-latest
|
|
needs: [ create-release ]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Build and push the Docker image
|
|
shell: pwsh
|
|
run: |
|
|
$version = '${{ github.event.ref }}'.Replace('refs/tags/', '').Replace('v', '')
|
|
|
|
docker build . --tag ghcr.io/g3rv4/getmoarfediverse:latest --tag "ghcr.io/g3rv4/getmoarfediverse:$version"
|
|
docker push ghcr.io/g3rv4/getmoarfediverse:latest
|
|
docker push "ghcr.io/g3rv4/getmoarfediverse:$version" |