Publish Release #4
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: Publish Release | |
on: | |
workflow_dispatch: | |
env: | |
APP_NAME: Place.API | |
SOLUTION: Place.sln | |
API_PROJECT: src/Place.API/Place.API.csproj | |
RUNTIME: linux-musl-x64 | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '9.0.x' | |
- name: Publish | |
run: make publish RUNTIME=${{ env.RUNTIME }} API_PROJECT=${{ env.API_PROJECT }} APP_NAME=${{ env.APP_NAME }} | |
- name: Create ZIP file | |
run: | | |
cd publish | |
zip -r ../${{ env.APP_NAME }}-${{ env.RUNTIME }}.zip ${{ env.RUNTIME }}/* | |
- name: Upload Release Asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload ${{ inputs.version }} \ | |
${{ env.APP_NAME }}-${{ env.RUNTIME }}.zip \ | |
--clobber | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push Docker Image | |
run: | | |
make docker RUNTIME=${{ env.RUNTIME }} \ | |
DOCKER_TAG=ghcr.io/${{ github.repository }}/${{ env.APP_NAME }}:${{ inputs.version }} | |
# Tag and push latest | |
docker tag ghcr.io/${{ github.repository }}/${{ env.APP_NAME }}:${{ inputs.version }}-x64 \ | |
ghcr.io/${{ github.repository }}/${{ env.APP_NAME }}:latest | |
docker push ghcr.io/${{ github.repository }}/${{ env.APP_NAME }}:latest |