-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
438 additions
and
1,687 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,11 @@ on: | |
- cron: "0 5 * * 1" | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build-image: | ||
name: Build images and push to registry | ||
|
@@ -19,7 +24,7 @@ jobs: | |
uses: docker/metadata-action@v4 | ||
id: meta-app | ||
with: | ||
bake-target: app | ||
bake-target: app-production | ||
images: | | ||
ghcr.io/${{ github.repository }}-app | ||
tags: | | ||
|
@@ -32,7 +37,7 @@ jobs: | |
uses: docker/metadata-action@v4 | ||
id: meta-web | ||
with: | ||
bake-target: web | ||
bake-target: web-production | ||
images: | | ||
ghcr.io/${{ github.repository }}-web | ||
tags: | | ||
|
@@ -41,102 +46,32 @@ jobs: | |
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }} | ||
- name: Generate cache tag for app image | ||
uses: docker/metadata-action@v4 | ||
id: cache-tag-app | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository }}-app | ||
tags: | | ||
type=ref,event=branch | ||
type=raw,enable=${{ github.ref_type == 'tag' }},value=${{ github.event.repository.default_branch }} | ||
flavor: | ||
suffix=-cache | ||
|
||
- name: Generate cache tag for web image | ||
- name: Generate ns8 image tags | ||
uses: docker/metadata-action@v4 | ||
id: cache-tag-web | ||
id: meta-ns8 | ||
with: | ||
bake-target: ns8 | ||
images: | | ||
ghcr.io/${{ github.repository }}-web | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch | ||
type=raw,enable=${{ github.ref_type == 'tag' }},value=${{ github.event.repository.default_branch }} | ||
flavor: | ||
suffix=-cache | ||
type=semver,pattern={{version}} | ||
- name: Login to Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
password: ${{ github.token }} | ||
|
||
- uses: docker/[email protected] | ||
with: | ||
targets: release | ||
targets: deploy | ||
files: | | ||
./docker-bake.hcl | ||
${{ steps.meta-app.outputs.bake-file }} | ||
${{ steps.meta-web.outputs.bake-file }} | ||
${{ steps.meta-ns8.outputs.bake-file }} | ||
set: | | ||
*.platform=linux/amd64 | ||
app.cache-from=type=registry,ref=${{ steps.cache-tag-app.outputs.tags }} | ||
app.cache-to=type=registry,ref=${{ steps.cache-tag-app.outputs.tags }},mode=max | ||
web.cache-from=type=registry,ref=${{ steps.cache-tag-web.outputs.tags }} | ||
web.cache-to=type=registry,ref=${{ steps.cache-tag-web.outputs.tags }},mode=max | ||
*.cache-to=type=gha,mode=max | ||
push: true | ||
|
||
build-deploy: | ||
name: Build NS8 deploy image | ||
runs-on: ubuntu-22.04 | ||
needs: build-image | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Generate tags | ||
uses: docker/metadata-action@v4 | ||
id: meta | ||
with: | ||
images: | | ||
ghcr.io/nethserver/ns8-phonehome | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
- name: Generate Phonehome image tags | ||
uses: docker/metadata-action@v4 | ||
id: phonehome-tags | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
- name: Login to Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build image with buildah | ||
env: | ||
TAGS: ${{ steps.meta.outputs.tags }} | ||
LABELS: ${{ steps.meta.outputs.labels }} | ||
ARGS: | | ||
PHONEHOME_TAG=${{ steps.phonehome-tags.outputs.version }} | ||
PHONEHOME_SERVER_APP=${{ steps.phonehome-tags.outputs.tags }}-app | ||
PHONEHOME_SERVER_WEB=${{ steps.phonehome-tags.outputs.tags }}-web | ||
working-directory: deploy/ns8 | ||
run: | | ||
./build-images.sh | ||
- name: Push image to registry | ||
run: | | ||
PUSH_TAGS='${{ steps.meta.outputs.tags }}' | ||
for tag in $PUSH_TAGS; do | ||
podman push "$tag" | ||
done |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,3 @@ jobs: | |
uses: ./.github/workflows/build.yml | ||
needs: | ||
- test-app-image | ||
secrets: inherit |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
name: Testing | ||
on: | ||
push: | ||
branches: | ||
- "renovate/**" | ||
pull_request: | ||
workflow_call: | ||
|
||
permissions: | ||
contents: read | ||
packages: read | ||
|
||
jobs: | ||
test-app-image: | ||
name: Test app image | ||
|
@@ -13,24 +21,14 @@ jobs: | |
- name: Create new buildx builder | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Generate Image Metadata | ||
uses: docker/metadata-action@v4 | ||
id: cache-from-tag | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository }}-app | ||
tags: | | ||
type=ref,event=branch | ||
type=raw,enable=${{ github.event_name == 'pull_request' }},value=${{ github.base_ref }} | ||
flavor: | | ||
latest=false | ||
suffix=-cache | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- uses: docker/[email protected] | ||
with: | ||
files: | | ||
./docker-bake.hcl | ||
targets: testing | ||
set: | | ||
*.platform=linux/amd64 | ||
*.cache-from=type=registry,ref=${{ steps.cache-from-tag.outputs.tags }} | ||
- name: Run testing | ||
run: | | ||
cp .env.example .env | ||
docker compose run --rm --build testing |
Oops, something went wrong.