Make API Container #35
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: Make API Container | |
on: | |
workflow_dispatch: | |
branches: [ main ] | |
release: | |
types: [ "published" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Extract tag name # Extract tag name based on event type | |
id: tag_name | |
run: | | |
if [[ $GITHUB_EVENT_NAME == 'release' ]]; then | |
echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/})" | |
else | |
echo "##[set-output name=tag;]latest" | |
fi | |
shell: bash | |
- name: Login to dockerhub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v2 | |
with: | |
tags: dustinupdyke/ghosts:${{ steps.tag_name.outputs.tag }} | |
push: true | |
context: src/. | |
file: ./src/Dockerfile-api |