--- (#344) #1227
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: Build Docker Container | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Get version name | |
shell: bash | |
run: echo "##[set-output name=name;]`echo ${GITHUB_REF#refs/tags/}`" | |
id: branch | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Build untagged Docker container | |
run: docker build . | |
if: startsWith(github.ref, 'refs/tags/') != true | |
- name: Build tagged Docker Container | |
run: docker build -t ractf/core:${{ steps.branch.outputs.name }} -t ghcr.io/ractf/core:${{ steps.branch.outputs.name }} -t ractf/core:latest -t ghcr.io/ractf/core:latest . | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Login to Docker Hub | |
run: docker login --username ractf --password ${{ secrets.password }} | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Login to Github Container Registry | |
run: echo ${{ secrets.ghtoken }} | docker login ghcr.io -u ${{ secrets.ghuser }} --password-stdin | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Push to Docker Hub | |
run: | | |
docker push ractf/core:${{ steps.branch.outputs.name }} | |
docker push ractf/core:latest | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Push to Github Container Registry | |
run: | | |
docker push ghcr.io/ractf/core:${{ steps.branch.outputs.name }} | |
docker push ghcr.io/ractf/core:latest | |
if: startsWith(github.ref, 'refs/tags/') |