Skip to content

增加 CPP 支持

增加 CPP 支持 #9

name: Challenge online_judge
on:
push:
branches: ["main"]
paths:
- "!**/README.md"
- "challenges/ppc/online_judge/build/**"
workflow_dispatch:
env:
TYPE: ppc
NAME: online_judge
REGISTRY: ghcr.io
jobs:
challenge-build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: x86_64-unknown-linux-musl
- name: Compile
run: |
cd challenges/${{ env.TYPE }}/${{ env.NAME }}/build
cargo build --release
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.NAME }}
tags: |
latest
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: challenges/${{ env.TYPE }}/${{ env.NAME }}/build
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true