feat: update release workflow with versioning and GitHub release steps #20
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: Docker Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: git config | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
- name: Set version variables | |
id: set-version | |
run: echo "VERSION=${{ steps.tag_version.outputs.new_version }}" >> $GITHUB_ENV | |
- name: Display version from tag_version | |
run: echo "Generated version:${{ steps.tag_version.outputs.new_version }}" | |
- name: Display version | |
run: echo ${{ env.VERSION }} | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore abp/ | |
- name: Build | |
run: dotnet build abp/ --no-restore | |
- name: Build Package | |
run: dotnet pack --output nupkgs --configuration Release /p:Version=${{ steps.set-version.outputs.VERSION }} | |
- name: Push to Nuget | |
run: dotnet nuget push "nupkgs/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate | |
- name: Docker Login | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.antosubash.com | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Docker Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: abp/AbpTemplate/Dockerfile | |
push: true | |
tags: | | |
registry.antosubash.com/abptemplate:dev | |
registry.antosubash.com/abptemplate:${{ steps.set-version.outputs.VERSION }} | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
- name: Send Http Post Request to Deploy API | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: ${{ secrets.WEBHOOK_URL }} | |
method: 'POST' |