diff options
| author | Ted John <[email protected]> | 2023-04-22 11:22:39 +0100 |
|---|---|---|
| committer | Ted John <[email protected]> | 2023-04-22 11:22:39 +0100 |
| commit | fffd73d3fc5a91ba32fa0259ea9aba2c0da42814 (patch) | |
| tree | f70e35fc4e381ee0f382d77c0d35a1d533bd29a9 /.github/workflows/ci.yml | |
| parent | 8dca384913644fbc6948b51b444fe14c2d4ae8be (diff) | |
| download | openrct2-docker-fffd73d3fc5a91ba32fa0259ea9aba2c0da42814.tar.gz openrct2-docker-fffd73d3fc5a91ba32fa0259ea9aba2c0da42814.zip | |
Add GitHub workflow for building and publishing the docker image
Diffstat (limited to '.github/workflows/ci.yml')
| -rw-r--r-- | .github/workflows/ci.yml | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c051171 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI +on: [push, pull_request] +env: + dockerid: ${{ secrets.dockerid }} + dockerpass: ${{ secrets.dockerpass }} +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # List of tags to build and upload, remember to update this + tag: [0.4.4] + env: + dockertag: ${{ matrix.tag }} + dockerimg: openrct2/openrct2-cli + dockerlst: 0.4.4 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build docker image + run: | + ctxpath=${dockertag//-/\/}/cli + echo "Building $dockerimg:$dockertag from $ctxpath..." + docker build -t $dockerimg:$dockertag $ctxpath + - name: Tag latest docker image + run: | + if [ "$dockertag" == "$dockerlst" ]; then + echo "Tagging $dockerimg:$dockertag as $dockerimg:latest..." + docker tag $dockerimg:$dockertag $dockerimg:latest + else + echo "Latest tag not updated" + fi + - name: Login to docker + run: | + if [ "$dockerid" != "" ]; then + docker login -u "$dockerid" -p "$dockerpass" + echo "Docker login successful" + else + echo "No docker login performed" + fi + - name: Publish docker images + if: startsWith(github.ref, 'refs/tags/v') + run: | + if [ "$dockerid" != "" ]; then + echo "Pushing $dockerimg:$dockertag..." + docker push $dockerimg:$dockertag + if [ "$dockertag" == "$dockerlst" ]; then + echo "Pushing $dockerimg:latest..." + docker push $dockerimg:latest + fi + else + echo "No docker images published" + fi |
