devstar-devcontainer-operator/.gitea/workflows/devstar-devcontainer-operator-ci.yaml
2024-10-14 06:55:25 +00:00

60 lines
2.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#
# Add secrets of Remote Git Repository Panel:
# - ${{ secrets.DOCKER_REGISTRY_USERNAME }}: username of Docker Registry
# - ${{ secrets.DOCKER_REGISTRY_PASSWORD }}: password corresponding to the Docker Registry username
# Add variables of Remote Git Repository Panel:
# - ${{ vars.DOCKER_REGISTRY_ADDRESS }}: the address for Docker Registry
# - ${{ vars.DOCKER_REPOSITORY_ARTIFACT}}: the artifact $name:$version, e.g., `devstar/devcontainer-operator:build`
# 特别注意:如果使用 devstar.cn 作为 Docker Registry需要设置 Gitea Actions Runner 变量 DOCKER_REGISTRY_ADDRESS = www.devstar.cn若没有www前缀会导致上传失败Ingress重定向规则导致暂时无解
# 上传 Artifact 必须加上 www前缀而拉取时不需要加 www 前缀,例如:
# 上传前 artifact 名称: docker push www.devstar.cn/devstar/devcontainer-operator:build-0047d315a3f73cca0c18c641d24b0347456618d5
# 拉取 artifact 只需要: docker pull devstar.cn/devstar/devcontainer-operator:build-0047d315a3f73cca0c18c641d24b0347456618d5
name: DevStar DevContainer Operator CI Pipeline - main branch
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build-and-push-devstar-devcontainer-operator:
runs-on: ubuntu-latest
steps:
- name: 🔍 Check out repository code
uses: actions/checkout@v4
with:
ref: main
- name: 🔧 Build DevStar DevContainer Operator
run: |
echo "${{ secrets.DOCKER_REGISTRY_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_REGISTRY_USERNAME }} ${{ vars.DOCKER_REGISTRY_ADDRESS }} --password-stdin
make docker-build docker-push IMG=${{ vars.DOCKER_REGISTRY_ADDRESS }}/${{ vars.DOCKER_REPOSITORY_ARTIFACT }}-${{ gitea.sha }}
- name: 🍏 Job Status Report
run: |
echo "🍏 This job's status is ${{ job.status }}."
echo "Output Artifact: ${{ vars.DOCKER_REGISTRY_ADDRESS }}/${{ vars.DOCKER_REPOSITORY_ARTIFACT }}-${{ gitea.sha }}"
echo ""
echo "Please deploy this version of k8s Operator by: make deploy IMG=${{ vars.DOCKER_REGISTRY_ADDRESS }}/${{ vars.DOCKER_REPOSITORY_ARTIFACT }}-${{ gitea.sha }}"
#
# P.S.:
################################################################################
# 1. How to config runner:
# $ docker run \
# --name gitea-act-runner-repo-devcontainer-operator \
# -d \
# -e GITEA_INSTANCE_URL=https://www.devstar.cn \
# -e GITEA_RUNNER_REGISTRATION_TOKEN=${YOUR_GITEA_RUNNER_REGISTRATION_TOKEN} \
# -v /var/run/docker.sock:/var/run/docker.sock \
# gitea/act_runner:latest
#
# 2. To clean the docker cache:
# $ docker builder prune --force
# $ if [ "$(docker volume ls -qf dangling=true)" ]; then docker volume rm $(docker volume ls -qf dangling=true); fi
#