Skip to content

[CD][Hai] add workflows branch name v2 #17

[CD][Hai] add workflows branch name v2

[CD][Hai] add workflows branch name v2 #17

Workflow file for this run

name: Publish docker images
on:
push:
tags: [ "v*" ]
env:
IMAGE_NAME: ${{ secrets.REGISTRY }}/swd392-domus/domus-api
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Encrypt Production appsettings
run: gpg --quiet --batch --yes --decrypt --passphrase ${{ secrets.GPG_PASS_PHRASE }} --output Domus.Api/appsettings.Production.json Domus.Api/appsettings.Production.json.gpg
- name: Restore dependencies
run: dotnet restore
- name: Build projects
run: dotnet build -c Release
- name: Get version
id: version
uses: battila7/get-version-action@v2
- name: Set tag as an output variable
id: set-tag
run: echo "::set-output name=tag::${{ steps.version.outputs.version-without-v }}"
- name: Build docker images
run: docker build -f Domus.Api/Dockerfile -t ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version-without-v }} .
- name: Authenticate
run: echo ${{ secrets.AUTH_TOKEN }} | docker login ${{ secrets.REGISTRY }} -u swd392-domus --password-stdin
- name: Publish images
run: docker push ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version-without-v }}
outputs:
tag: ${{ steps.set-tag.outputs.tag }}