教师查看学生详情页面修改 #34
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
# yaml-language-server: $schema=https://json-schema.org/draft-07/schema# | |
name: Release | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
release_github_packages: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.check_version.outputs.tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Check Version | |
id: check_version | |
shell: bash | |
run: | | |
if [[ -f VERSION ]]; then | |
version=$(cat VERSION) | |
tags=$(git tag --list) | |
echo $tags | |
if [[ ! "$tags" =~ (^|[[:space:]])"$version"($|[[:space:]]) ]]; then | |
echo $version | |
echo "::set-output name=tag::$version" | |
fi | |
fi | |
- name: Create Tag | |
if: ${{ startsWith(steps.check_version.outputs.tag, 'v') }} | |
run: | | |
git tag ${{ steps.check_version.outputs.tag }} | |
git push origin ${{ steps.check_version.outputs.tag }} | |
- name: Release | |
if: ${{ startsWith(steps.check_version.outputs.tag, 'v') }} | |
run: npx changelogithub | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release-docker-image: | |
runs-on: ubuntu-latest | |
needs: release_github_packages | |
if: ${{ startsWith(needs.release_github_packages.outputs.tag, 'v') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set Tag | |
id: get-tag | |
run: | | |
tag=$(cat VERSION) | |
echo "before: ${tag}" | |
prefix="v" | |
tag=${tag#"${prefix}"} | |
echo "::set-output name=tag::$(echo $tag)" | |
echo "after: ${tag}" | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- name: Available platforms | |
run: echo ${{ steps.qemu.outputs.platforms }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Inspect builder | |
run: | | |
echo "Name: ${{ steps.buildx.outputs.name }}" | |
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | |
echo "Status: ${{ steps.buildx.outputs.status }}" | |
echo "Flags: ${{ steps.buildx.outputs.flags }}" | |
echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to ALiYun Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.cn-beijing.aliyuncs.com | |
username: ${{ secrets.ALIYUN_REGISTRY_USERNAME }} | |
password: ${{ secrets.ALIYUN_REGISTRY_TOKEN }} | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-single-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-single-buildx | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
env: | |
image_name: hznuoj | |
tag: ${{ steps.get-tag.outputs.tag }} | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
hznuoj/${{ env.image_name }}:latest | |
hznuoj/${{ env.image_name }}:${{ env.tag }} | |
registry.cn-beijing.aliyuncs.com/dup4/${{ env.image_name }}:latest | |
registry.cn-beijing.aliyuncs.com/dup4/${{ env.image_name }}:${{ env.tag }} | |
# cache-from: type=local,src=/tmp/.buildx-cache | |
# cache-to: type=local,dest=/tmp/.buildx-cache-new | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
# - name: Move cache | |
# run: | | |
# rm -rf /tmp/.buildx-cache | |
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache |