Auth rewrite (#21) #16
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 for GHCR | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build_and_publish: | |
environment: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get latest release tag | |
id: get_release | |
run: | | |
latest_tag=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r .tag_name) | |
echo "Latest Release Tag: $latest_tag" | |
echo "::set-output name=latest_tag::$latest_tag" | |
- uses: actions/checkout@v3 | |
- name: Build and push the image | |
run : | | |
docker login --username CoolCoderSJ --password ${{ secrets.GH_PAT }} ghcr.io | |
docker build -t ghcr.io/coolcodersj/hcgateway:latest -t ghcr.io/coolcodersj/hcgateway:${{ steps.get_release.outputs.latest_tag }}-${{ github.sha }} -f ./api/Dockerfile ./api | |
docker push ghcr.io/coolcodersj/hcgateway:latest | |
docker push ghcr.io/coolcodersj/hcgateway:${{ steps.get_release.outputs.latest_tag }}-${{ github.sha }} |