Skip to content

Commit fb97771

Browse files
committed
ci: migrate to main branch only
1 parent 73ce167 commit fb97771

File tree

4 files changed

+79
-11
lines changed

4 files changed

+79
-11
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: CI - Biome and TypeScript
22
on:
33
push:
4-
branches: [develop, main]
4+
branches: [main]
55
pull_request:
6-
branches: [develop, main]
6+
branches: [main]
77
jobs:
88
test:
99
name: Run biome and typescript checks

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: ["main", "develop"]
16+
branches: "main"
1717
pull_request:
18-
branches: ["main", "develop"]
18+
branches: "main"
1919
schedule:
2020
- cron: "19 20 * * 3"
2121

.github/workflows/deploy-webapp.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
name: Create and publish a Docker image
1+
name: Build and publish alpha Docker image
22

3-
# Configures this workflow to run on push to the develop branch and on tag creation.
3+
# Only run this workflow on pushes to main branch, not on tags
44
on:
55
push:
6-
branches: ["develop"]
7-
tags:
8-
- "*"
6+
branches: ["main"]
97

108
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
119
env:
@@ -38,6 +36,12 @@ jobs:
3836
uses: docker/metadata-action@v5
3937
with:
4038
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+
tags: |
40+
# For pushes to main, add the 'alpha-latest' tag
41+
type=raw,value=alpha-latest
42+
flavor: |
43+
# Don't use the 'latest' tag at all
44+
latest=false
4145
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
4246
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
4347
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
@@ -49,9 +53,9 @@ jobs:
4953
tags: ${{ steps.meta.outputs.tags }}
5054
labels: |
5155
${{ steps.meta.outputs.labels }}
52-
${{ !startsWith(github.ref, 'refs/tags/') && 'develop' || 'release' }}
56+
type=alpha
5357
build-args: |
5458
EXPO_PUBLIC_THI_API_KEY=${{ secrets.EXPO_PUBLIC_THI_API_KEY }}
55-
EXPO_PUBLIC_NEULAND_GRAPHQL_ENDPOINT=${{ !startsWith(github.ref, 'refs/tags/') && vars.GRAPHQL_ENDPOINT_DEV || vars.GRAPHQL_ENDPOINT_PROD }}
59+
EXPO_PUBLIC_NEULAND_GRAPHQL_ENDPOINT=${{ vars.GRAPHQL_ENDPOINT_DEV }}
5660
EXPO_PUBLIC_APTABASE_KEY=${{ secrets.EXPO_PUBLIC_APTABASE_KEY }}
5761
EXPO_PUBLIC_GIT_COMMIT_HASH=${{ github.sha }}

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
tags:
66
- "*"
77

8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}/webapp
11+
812
jobs:
913
changelog:
1014
name: Generate changelog
@@ -45,6 +49,66 @@ jobs:
4549
body: ${{ steps.git-cliff.outputs.content }}
4650
prerelease: ${{ env.PRERELEASE }}
4751

52+
build-docker-image:
53+
name: Build and publish Docker image
54+
runs-on: ubuntu-latest
55+
needs: changelog
56+
permissions:
57+
id-token: write
58+
contents: read
59+
attestations: write
60+
packages: write
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
65+
- name: Determine if prerelease
66+
run: |
67+
if [[ "${{ github.ref }}" =~ - ]]; then
68+
echo "PRERELEASE=true" >> $GITHUB_ENV
69+
echo "TAG_TYPE=beta" >> $GITHUB_ENV
70+
echo "ENDPOINT=DEV" >> $GITHUB_ENV
71+
else
72+
echo "PRERELEASE=false" >> $GITHUB_ENV
73+
echo "TAG_TYPE=release" >> $GITHUB_ENV
74+
echo "ENDPOINT=PROD" >> $GITHUB_ENV
75+
fi
76+
77+
- name: Log in to the Container registry
78+
uses: docker/login-action@v3
79+
with:
80+
registry: ${{ env.REGISTRY }}
81+
username: ${{ github.actor }}
82+
password: ${{ secrets.GITHUB_TOKEN }}
83+
84+
- name: Extract tag name
85+
id: tag_name
86+
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
87+
88+
- name: Extract metadata (tags, labels) for Docker
89+
id: meta
90+
uses: docker/metadata-action@v5
91+
with:
92+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
93+
tags: |
94+
type=raw,value=${{ steps.tag_name.outputs.TAG }}
95+
type=raw,value=${{ env.TAG_TYPE }}-latest
96+
97+
- name: Build and push Docker image
98+
uses: docker/build-push-action@v6
99+
with:
100+
context: .
101+
push: true
102+
tags: ${{ steps.meta.outputs.tags }}
103+
labels: |
104+
${{ steps.meta.outputs.labels }}
105+
type=${{ env.TAG_TYPE }}
106+
build-args: |
107+
EXPO_PUBLIC_THI_API_KEY=${{ secrets.EXPO_PUBLIC_THI_API_KEY }}
108+
EXPO_PUBLIC_NEULAND_GRAPHQL_ENDPOINT=${{ vars.GRAPHQL_ENDPOINT_PROD }}
109+
EXPO_PUBLIC_APTABASE_KEY=${{ secrets.EXPO_PUBLIC_APTABASE_KEY }}
110+
EXPO_PUBLIC_GIT_COMMIT_HASH=${{ github.sha }}
111+
48112
build-android:
49113
name: Build Android app
50114
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)