Skip to content

Commit

Permalink
👷 update github workflows
Browse files Browse the repository at this point in the history
 add a build check for all pull requests to and automatically build
 and push the containerfile to the ghcr on all pushs to development
 and master. Other pipelines do not wait for the container to be
 pushed which means that they may have to be manually restarted if
 they fail due to an old container image.
  • Loading branch information
gthvmt committed Dec 19, 2023
1 parent a78cbe4 commit 56ef022
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM rust:bookworm

#
ARG VERSION="stable"
ARG FLUTTER_URL="https://github.com/flutter/flutter"
ARG ANDROID_SDK_TOOLS_VERSION=9477386
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/push_container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Push container
on:
push:
branches:
- development
- master
paths:
- '.devcontainer/Containerfile'

jobs:
push:
name: Push container image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{secrets.TOKEN}}
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.repository_owner}}
password: ${{secrets.TOKEN}}
- name: Build and push Docker image
run: |
docker build . -f ./.devcontainer/Containerfile -t ghcr.io/${{ github.repository_owner }}/7tv4wa-dev:${{ github.head_ref || github.ref_name }} -t ghcr.io/${{ github.repository_owner }}/7tv4wa-dev:latest
docker push ghcr.io/${{ github.repository_owner }}/7tv4wa-dev --all-tags
8 changes: 7 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ jobs:
name: Create release
runs-on: ubuntu-latest
container:
image: ghcr.io/gthvmt/7tv4wa-dev
image: >-
ghcr.io/${{ github.repository_owner }}/7tv4wa-dev:${{
(github.event_name == 'pull_request' &&
(github.event.pull_request.base.ref == 'development' ||
github.event.pull_request.base.ref == 'master')) &&
github.event.pull_request.base.ref ||
'latest' }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/test_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build
on:
pull_request:
types:
- opened
- synchronize

permissions:
contents: read
pull-requests: read

jobs:
build:
name: Build APK
runs-on: ubuntu-latest
container:
image: >-
ghcr.io/${{ github.repository_owner }}/7tv4wa-dev:${{
(github.event_name == 'pull_request' &&
(github.event.pull_request.base.ref == 'development' ||
github.event.pull_request.base.ref == 'master')) &&
github.event.pull_request.base.ref ||
'latest' }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
env:
GITHUB_TOKEN: ${{secrets.TOKEN}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
token: ${{secrets.TOKEN}}
- name: Build apk
run: chmod +x .github/workflows/*.sh && .github/workflows/build.sh

0 comments on commit 56ef022

Please sign in to comment.