forked from matrix-org/mjolnir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add docker build and push to GHCR + Beeper registry, remove upstr…
…eam dockerhub build Signed-off-by: Sumner Evans <[email protected]>
- Loading branch information
1 parent
0e94bc7
commit 109d927
Showing
3 changed files
with
71 additions
and
69 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: GHCR + Beeper Docker Registry | ||
|
||
on: [push] | ||
|
||
env: | ||
CI_REGISTRY_IMAGE: "${{ secrets.CI_REGISTRY }}/mjolnir" | ||
GHCR_REGISTRY: ghcr.io | ||
GHCR_REGISTRY_IMAGE: "ghcr.io/${{ github.repository }}" | ||
|
||
jobs: | ||
build-docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ secrets.CI_REGISTRY }} | ||
username: ${{ secrets.CI_REGISTRY_USER }} | ||
password: ${{ secrets.CI_REGISTRY_PASSWORD }} | ||
|
||
- name: Login to ghcr | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.GHCR_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker Build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
cache-from: ${{ env.CI_REGISTRY_IMAGE }}:latest | ||
pull: true | ||
file: Dockerfile | ||
tags: | | ||
${{ env.CI_REGISTRY_IMAGE }}:${{ github.sha }} | ||
${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }} | ||
push: true | ||
|
||
deploy-docker: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-docker | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- name: Login to Beeper Docker registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ secrets.CI_REGISTRY }} | ||
username: ${{ secrets.CI_REGISTRY_USER }} | ||
password: ${{ secrets.CI_REGISTRY_PASSWORD }} | ||
|
||
- name: Login to ghcr | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.GHCR_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: beeper/docker-retag-push-latest@main | ||
with: | ||
image: ${{ env.CI_REGISTRY_IMAGE }} | ||
|
||
- uses: beeper/docker-retag-push-latest@main | ||
with: | ||
image: ${{ env.GHCR_REGISTRY_IMAGE }} | ||
|