Skip to content

Automatic building of docker image #67390

Automatic building of docker image

Automatic building of docker image #67390

Workflow file for this run

name: Automatic building of docker image
on:
schedule:
- cron: "*/20 * * * *"
push:
jobs:
auto-build:
runs-on: ubuntu-latest
steps:
- id: latest-fivem-tag
run: |
echo tag=$(curl -fH "Accept: application/vnd.github.v3+json" --url "https://api.github.com/repos/citizenfx/fivem/tags?per_page=100" | jq -r 'first(.[] | {name: .name | match("v1.0.0.(\\d+)").captures | .[].string}).name') >> $GITHUB_OUTPUT
- id: docker-image
if: ${{ steps.latest-fivem-tag.outputs.tag != null }}
run: |
echo exists=$(curl -s "https://hub.docker.com/v2/repositories/traskin/fxserver/tags/${{ steps.latest-fivem-tag.outputs.tag }}/" | jq '.last_updated != null') >> $GITHUB_OUTPUT
- id: fxserver-artifact
if: ${{ steps.docker-image.outputs.exists == 'false' }}
run: |
echo response=$(curl -s --head -w %{http_code} https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/$(curl -sH "Accept: application/vnd.github.v3+json" --url "https://api.github.com/repos/citizenfx/fivem/tags?per_page=100" | jq -r 'first(.[] | {name: .name | match("v1.0.0.(${{ steps.latest-fivem-tag.outputs.tag }})").captures | .[].string, hash: .commit.sha} | join("-"))')/fx.tar.xz -o /dev/null) >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
if: ${{ steps.fxserver-artifact.outputs.response == '200' }}
- uses: docker/login-action@v3
if: ${{ steps.fxserver-artifact.outputs.response == '200' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v6
if: ${{ steps.fxserver-artifact.outputs.response == '200' }}
with:
push: true
build-args: |
artifact=${{ steps.latest-fivem-tag.outputs.tag }}
tags: |
traskin/fxserver:${{ steps.latest-fivem-tag.outputs.tag }}
traskin/fxserver:latest