Skip to content

fix(ci): Revert "feat(Docker): Add arm docker image support (#135)" (… #21

fix(ci): Revert "feat(Docker): Add arm docker image support (#135)" (…

fix(ci): Revert "feat(Docker): Add arm docker image support (#135)" (… #21

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
version:
runs-on: ubuntu-latest
steps:
- id: get-version-tag
run: |
export GITHUB_REF_NAME="${{ github.ref_name }}"
export RELEASE_VERSION="${GITHUB_REF_NAME#v}"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
outputs:
RELEASE_VERSION: ${{ steps.get-version-tag.outputs.RELEASE_VERSION }}
verify:
name: Run tests
runs-on: ubuntu-latest
needs: version
steps:
- uses: actions/checkout@v4.1.1
- name: Setup .NET
uses: actions/setup-dotnet@v4.0.0
with:
global-json-file: global.json
- name: Test
run: dotnet test --verbosity normal
release_zip:
if: ${{ github.ref_type == 'tag' }}
needs: [version, verify]
name: Release BaGetter.zip to GitHub
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4.0.0
with:
global-json-file: global.json
- name: Publish
run: |
dotnet publish src/BaGetter --configuration Release --output artifacts --property:Version=${{ needs.version.outputs.RELEASE_VERSION }}
echo ${{ github.sha }} > artifacts/ReleaseSha.txt
7z a -tzip bagetter-${{ needs.version.outputs.RELEASE_VERSION }}.zip ./artifacts/*
- name: Generate changelog with git-cliff
uses: tj-actions/git-cliff@v1.4.2
with:
args: --latest --strip all
output: "CHANGELOG.md"
- name: Create release with ncipollo/release-action
uses: ncipollo/release-action@v1.14.0
with:
bodyFile: "CHANGELOG.md"
artifacts: "bagetter-${{ needs.version.outputs.RELEASE_VERSION }}.zip"
name: ${{ needs.version.outputs.RELEASE_VERSION }}
prerelease: ${{ contains(github.ref_name, '-') }}
release_packages:
if: ${{ github.ref_type == 'tag' }}
needs: [version, verify]
name: Release packages to nuget.org
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- name: Setup .NET
uses: actions/setup-dotnet@v4.0.0
with:
global-json-file: global.json
- name: Pack
run: |
export PackageVersion=${{ needs.version.outputs.RELEASE_VERSION }}
export PackageSource=${PackageSource:="https://api.nuget.org/v3/index.json"}
echo "PackageSource=${PackageSource}" >> $GITHUB_ENV
dotnet pack --configuration Release --output artifacts --property:Version=${{ needs.version.outputs.RELEASE_VERSION }}
- name: Push
run: dotnet nuget push "*" -s ${PackageSource} -k ${{secrets.NUGET_API_KEY}}
working-directory: artifacts
release_docker_image:
if: ${{ github.ref_type == 'tag' }}
needs: [version, verify]
name: Release Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- name: Login to Docker Hub
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set release version
run: echo "PackageVersion=${{ needs.version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v5.1.0
with:
context: .
push: true
tags: |
bagetter/bagetter:latest
bagetter/bagetter:${{ needs.version.outputs.RELEASE_VERSION }}
build-args: |
Version=${{ needs.version.outputs.RELEASE_VERSION }}