Merge pull request #711 from l1b0k/feat/policy #1366
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 | |
on: | |
push: | |
branches: [main] | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [main] | |
env: | |
REGISTRY: ghcr.io | |
OWNER: AliyunContainerService | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }} | |
cancel-in-progress: true | |
jobs: | |
build-terway: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/terway | |
tags: | | |
type=raw,value={{date 'YYYYMMDD'}}-{{sha}} | |
type=semver,pattern={{version}} | |
type=semver,pattern={{raw}} | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ github.event_name != 'pull_request' && github.event.action != 'unassigned' }} | |
- name: Build | |
run: | | |
make build | |
- name: Build and push | |
run: | | |
make REGISTRY=ghcr.io/aliyuncontainerservice build-push | |
if: ${{ github.event_name != 'pull_request' && github.event.action != 'unassigned' }} |