Skip to content

Commit

Permalink
Merge branch 'main' of github.com:keinenclue/sasm-docker into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dorianim committed Nov 15, 2021
2 parents 4440e1a + 2a332e2 commit f3c24b6
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 38 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: "Build docker image"

on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
build-and-push-docker:
name: Build and push Docker image to GhCr
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/keinenclue/sasm-docker
tags: type=ref,event=tag

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-and-push-docker-manually:
name: Build and push Docker image to GhCr with previous tag
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
fetch-depth: 0 # Required due to the weg Git works, without it this action won't be able to find any or the correct tags

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/keinenclue/sasm-docker
tags: type=semver,pattern={{version}},value=${{ steps.previoustag.outputs.tag }}
flavor: |
latest=true
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
36 changes: 1 addition & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,44 +69,10 @@ jobs:
name: launcher
path: launcher/out/*

build-and-push-docker:
name: Build and push Docker image to GhCr
runs-on: ubuntu-latest
needs: build-launcher
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/keinenclue/sasm-docker
tags: type=ref,event=tag

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
needs: [build-and-push-docker, build-launcher]
needs: build-launcher
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')

steps:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ RUN apk add build-base qt5-qtbase-dev unzip curl \
msttcorefonts-installer && \
update-ms-fonts && \
fc-cache -f && \
curl -L -o sasm.zip https://github.com/Dman95/SASM/archive/refs/tags/v3.12.1.zip && \
curl -L -o sasm.zip https://codeload.github.com/schreiberx/SASM/zip/refs/heads/master && \
unzip sasm.zip -d /home && \
cd /home/SASM-3.12.1 && qmake-qt5 && make && make install
cd /home/SASM-master && qmake-qt5 && make && make install


# Source: https://gist.github.com/bcardiff/85ae47e66ff0df35a78697508fcb49af#gistcomment-2078660
Expand Down Expand Up @@ -40,4 +40,4 @@ COPY --from=build /usr/share/sasm /usr/share/sasm
# Install fonts
RUN fc-cache -f -v

CMD ["sasm"]
CMD ["sasm"]

0 comments on commit f3c24b6

Please sign in to comment.