chore(deps): update gameservermanagers/gameserver:sdtd docker digest … #948
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: "Build Docker Image" | |
on: | |
- push | |
jobs: | |
matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: set-matrix | |
run: echo "matrix=$(cd images && ls -d * | jq --raw-input --slurp --compact-output 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT} | |
build-docker: | |
needs: [ matrix ] | |
strategy: | |
matrix: | |
path: ${{ fromJson(needs.matrix.outputs.matrix) }} | |
runs-on: self-hosted | |
env: | |
IMAGE_NAME: joshhsoj1902/docker-linuxgsm-images | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
changed: | |
- 'images/${{ matrix.path }}/**' | |
- '.github/**' | |
- 'common/**' | |
- 'do' | |
- name: Build Image | |
# Only build on change, or on Main/Tag | |
if: ${{ ((github.ref == 'refs/heads/main') || (startsWith(github.ref, 'refs/tags'))) || (steps.filter.outputs.changed == 'true') }} | |
run: IMAGE_DIR=${{ matrix.path }} ./do build | |
- name: Test Image | |
# Only retest if there was a change | |
if: steps.filter.outputs.changed == 'true' | |
shell: bash | |
run: | | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
IMAGE_DIR=${{ matrix.path }} ./do test | |
- name: "Cleanup" | |
if: failure() | |
run: docker compose -f images/${{ matrix.path }}/.tests/docker-compose.yml down | |
- name: Deploy Main | |
if: ${{ (github.ref == 'refs/heads/main') }} | |
env: | |
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }} | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
run: | | |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | |
IMAGE_TAG="0.0.${{ github.run_id }}-${{ matrix.path }}" | |
docker tag $IMAGE_NAME:latest-${{ matrix.path }} $IMAGE_NAME:$IMAGE_TAG | |
docker push $IMAGE_NAME:latest-${{ matrix.path }} | |
docker push $IMAGE_NAME:$IMAGE_TAG | |
- name: Deploy Tag | |
if: ${{ (startsWith(github.ref, 'refs/tags')) }} | |
env: | |
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }} | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
run: | | |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | |
IMAGE_TAG="${{ github.ref_name }}" | |
docker tag $IMAGE_NAME:latest-${{ matrix.path }} $IMAGE_NAME:$IMAGE_TAG-${{ matrix.path }} | |
docker push $IMAGE_NAME:$IMAGE_TAG-${{ matrix.path }} |