name: docker on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Build container run: docker build -f DiscordChatExporter.Cli.dockerfile . deploy-latest: if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref_name == 'master' }} runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Login to DockerHub run: docker login -u tyrrrz -p ${{ secrets.DOCKER_TOKEN }} - name: Build container run: docker build -f DiscordChatExporter.Cli.dockerfile -t tyrrrz/discordchatexporter:latest . - name: Push container run: docker push tyrrrz/discordchatexporter:latest deploy-stable: if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Get release version id: get_version uses: dawidd6/action-get-tag@v1 - name: Login to DockerHub run: docker login -u tyrrrz -p ${{ secrets.DOCKER_TOKEN }} - name: Build container run: docker build -f DiscordChatExporter.Cli.dockerfile -t tyrrrz/discordchatexporter:stable -t tyrrrz/discordchatexporter:${{ steps.get_version.outputs.tag }} . - name: Push container (stable) run: docker push tyrrrz/discordchatexporter:stable - name: Push container (${{ steps.get_version.outputs.tag }}) run: docker push tyrrrz/discordchatexporter:${{ steps.get_version.outputs.tag }}