Add explicit handling of existing export files #1085
This file contains hidden or 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 | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - "*" | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| # Outputs from this job aren't really used, but it's here to verify that the Dockerfile builds correctly | |
| pack: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| actions: write | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Install Docker Buildx | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | |
| - name: Build image | |
| run: > | |
| docker buildx build . | |
| --file DiscordChatExporter.Cli.dockerfile | |
| --platform linux/amd64,linux/arm64 | |
| --build-arg VERSION=${{ github.ref_type == 'tag' && github.ref_name || format('999.9.9-ci-{0}', github.sha) }} | |
| --output type=tar,dest=DiscordChatExporter.Cli.Docker.tar | |
| - name: Upload image | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: DiscordChatExporter.Cli.Docker | |
| path: DiscordChatExporter.Cli.Docker.tar | |
| if-no-files-found: error | |
| deploy: | |
| # Deploy to DockerHub only on tag push or master branch push | |
| if: ${{ github.ref_type == 'tag' || github.ref_type == 'branch' && github.ref_name == 'master' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Install Docker Buildx | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | |
| - name: Login to DockerHub | |
| run: > | |
| echo ${{ secrets.DOCKER_TOKEN }} | | |
| docker login --username tyrrrz --password-stdin | |
| - name: Build & push image | |
| run: > | |
| docker buildx build . | |
| --file DiscordChatExporter.Cli.dockerfile | |
| --platform linux/amd64,linux/arm64 | |
| --build-arg VERSION=${{ github.ref_type == 'tag' && github.ref_name || format('999.9.9-ci-{0}', github.sha) }} | |
| --push | |
| --tag tyrrrz/discordchatexporter:latest | |
| ${{ github.ref_type == 'tag' && '--tag tyrrrz/discordchatexporter:$GITHUB_REF_NAME' || '' }} | |
| ${{ github.ref_type == 'tag' && '--tag tyrrrz/discordchatexporter:stable' || '' }} |