refactor: require REPO_DOMAIN in build workflow to be manually set using git secrets
Some checks failed
Build and push Docker image / build-and-push (push) Has been cancelled

This commit is contained in:
Jo 2024-01-08 00:37:47 +00:00
parent d7841543cf
commit e372802a15

View file

@ -6,10 +6,11 @@ on:
- main
# Secrets you have to set up for this to work:
# REPO_DOMAIN: The domain of your gitea instance (eg. https://git.cool.dev)
# REPO_TOKEN: A gitea access token for the repo
# REGISTRY_USERNAME/PASSWORD: The username and password for the docker registry of choice
env:
DOCKER_REPO: git.jo-dev.xyz/jo
DOCKER_REPO: ${{ REPO_DOMAIN }}/jo
DOCKER_TAG: latest
GITEA_REPO: jo/expresstemplate
GITEA_TOKEN: ${{ secrets.REPO_TOKEN }}
@ -36,19 +37,19 @@ jobs:
- name: Login to Docker registry
uses: docker/login-action@v1
with:
registry: git.jo-dev.xyz
registry: ${{ REPO_DOMAIN }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build Docker image
run: |
docker build -t ${DOCKER_REPO}:${DOCKER_TAG} .
docker tag ${DOCKER_REPO}:${DOCKER_TAG} git.jo-dev.xyz/${GITEA_REPO}:${DOCKER_TAG}
docker tag ${DOCKER_REPO}:${DOCKER_TAG} ${{ REPO_DOMAIN }}/${GITEA_REPO}:${DOCKER_TAG}
- name: Push Docker image to Gitea package
run: |
docker push git.jo-dev.xyz/${GITEA_REPO}:${DOCKER_TAG}
docker push ${{ REPO_DOMAIN }}/${GITEA_REPO}:${DOCKER_TAG}
curl -X POST -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"tag_name": "'"${DOCKER_TAG}"'"}' \
https://git.jo-dev.xyz/api/v1/repos/${GITEA_REPO}/releases
https://${{ REPO_DOMAIN }}/api/v1/repos/${GITEA_REPO}/releases