Original login blocks from main branch

This commit is contained in:
Tom Foster 2024-04-24 20:42:23 +01:00 committed by GitHub
parent 85eb47bcbb
commit ae360ec29f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -181,55 +181,31 @@ jobs:
ID_X86_64=$(docker load -i oci-image-x86_64-unknown-linux-musl-jemalloc.tar.gz | sed -n 's/Loaded image: \(.*\)/\1/p')
docker tag $ID_X86_64 conduwuit:${{ github.sha }}-x86_64-jemalloc
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
env:
GITHUB_USERNAME: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ (env.GITHUB_USERNAME != '') && (env.GITHUB_TOKEN != '') }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push combined manifest to GitHub
env:
GITHUB_USERNAME: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && (github.event_name != 'pull_request') && (env.GITHUB_USERNAME != '') && (env.GITHUB_TOKEN != '') }}
run: |
REPO_GHCR="ghcr.io/${{ github.repository }}"
SHA_TAG="${{ github.ref_name }}-${{ github.sha }}"
BRANCH_TAG="${{ github.ref_name }}"
if [ "$BRANCH_TAG" == "main" ]; then
BRANCH_TAG="latest"
fi
docker manifest create $REPO_GHCR:$SHA_TAG \
--amend conduwuit:${{ github.sha }}-x86_64-jemalloc \
--amend conduwuit:${{ github.sha }}-aarch64-jemalloc
docker manifest push $REPO_GHCR:$SHA_TAG
docker manifest create $REPO_GHCR:$BRANCH_TAG \
--amend conduwuit:${{ github.sha }}-x86_64-jemalloc \
--amend conduwuit:${{ github.sha }}-aarch64-jemalloc
docker manifest push $REPO_GHCR:$BRANCH_TAG
- name: Login to Docker Hub
uses: docker/login-action@v3
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
if: ${{ (env.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
if: ${{ (github.event_name != 'pull_request') && (env.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
env:
REGISTRY: ghcr.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push combined manifest to Docker Hub
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && (github.event_name != 'pull_request') && (env.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
if: ${{ (github.event_name != 'pull_request') && (env.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
run: |
REPO_DOCKER="docker.io/${{ github.repository }}"
SHA_TAG="${{ github.ref_name }}-${{ github.sha }}"
@ -247,3 +223,23 @@ jobs:
--amend conduwuit:${{ github.sha }}-x86_64-jemalloc \
--amend conduwuit:${{ github.sha }}-aarch64-jemalloc
docker manifest push $REPO_DOCKER:$BRANCH_TAG
- name: Create and push combined manifest to GitHub
if: github.event_name != 'pull_request'
run: |
REPO_GHCR="ghcr.io/${{ github.repository }}"
SHA_TAG="${{ github.ref_name }}-${{ github.sha }}"
BRANCH_TAG="${{ github.ref_name }}"
if [ "$BRANCH_TAG" == "main" ]; then
BRANCH_TAG="latest"
fi
docker manifest create $REPO_GHCR:$SHA_TAG \
--amend conduwuit:${{ github.sha }}-x86_64-jemalloc \
--amend conduwuit:${{ github.sha }}-aarch64-jemalloc
docker manifest push $REPO_GHCR:$SHA_TAG
docker manifest create $REPO_GHCR:$BRANCH_TAG \
--amend conduwuit:${{ github.sha }}-x86_64-jemalloc \
--amend conduwuit:${{ github.sha }}-aarch64-jemalloc
docker manifest push $REPO_GHCR:$BRANCH_TAG