新增容器镜像回滚功能 #53
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
name: build udocker release | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: write | |
env: | |
PYTHON_VERSION: '3.9.13' | |
RELEASE_VERSION: 'v1.1.3' # 发布版本 | |
DOCKER_IMAGE_NAME: 'udocker' | |
DOCKER_NAMESPACE: 'llody' | |
DOCKER_REGISTRY_HUAWEI: 'swr.cn-southwest-2.myhuaweicloud.com' | |
DOCKER_REGISTRY_ALIYUM: 'registry.cn-hangzhou.aliyuncs.com' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} | |
HWYUM_DOCKER_USERNAME: ${{ secrets.HWYUM_DOCKER_USERNAME }} | |
HWYUM_DOCKER_PASSWORD: ${{ secrets.HWYUM_DOCKER_PASSWORD }} | |
ALIYUM_DOCKER_USERNAME: ${{ secrets.ALIYUM_DOCKER_USERNAME }} | |
ALIYUM_DOCKER_PASSWORD: ${{ secrets.ALIYUM_DOCKER_PASSWORD }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setting up the Python version | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: install requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: run python test | |
run: | | |
python manage.py test | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Login DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKER_HUB_USERNAME }} | |
password: ${{ env.DOCKER_HUB_TOKEN }} | |
- name: Login to Huawei Cloud Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.DOCKER_REGISTRY_HUAWEI }} | |
username: ${{ env.HWYUM_DOCKER_USERNAME }} | |
password: ${{ env.HWYUM_DOCKER_PASSWORD }} | |
- name: build images | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: . | |
tags: | | |
${{ env.DOCKER_NAMESPACE }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.RELEASE_VERSION }} | |
${{ env.DOCKER_NAMESPACE }}/${{ env.DOCKER_IMAGE_NAME }}:latest | |
platforms: linux/amd64,linux/arm64 | |
- name: sync images to Huawei Cloud Container registry | |
run: | | |
chmod +x ./bin/skopeo | |
./bin/skopeo copy --all docker://docker.io/${{ env.DOCKER_NAMESPACE }}/udocker:v1.1.3 docker://${{ env.DOCKER_REGISTRY_HUAWEI }}/${{ env.DOCKER_NAMESPACE }}/udocker:v1.1.3 | |
./bin/skopeo copy --all docker://docker.io/${{ env.DOCKER_NAMESPACE }}/udocker:latest docker://${{ env.DOCKER_REGISTRY_HUAWEI }}/${{ env.DOCKER_NAMESPACE }}/udocker:latest | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create a compressed archive of the project | |
run: | | |
tar -czf release.tar.gz * | |
mkdir -p release | |
mv release.tar.gz release/ | |
- name: Upload release artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release-archive | |
path: release/release.tar.gz | |
- name: Create a GitHub release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.RELEASE_VERSION }} | |
release_name: Release ${{ env.RELEASE_VERSION }} | |
body: | | |
- **新版本发布**: ${{ env.RELEASE_VERSION }} | |
- **更新内容**: | |
- * 镜像仓库-新增备注信息。 | |
- * BUG - 优化镜像过多时加载慢的情况。 | |
- * 系统信息 - 新增主机使用率展示。 | |
- * 镜像仓库-新增dockerhub代理,(docker.llody.cn)。 | |
- * 页面优化。 | |
- * 流水线优化 - 新增同步国内镜像仓库镜像。 | |
draft: false | |
prerelease: false | |
files: release/release.tar.gz |