Publish shadowsocks-rust container images based on Ubuntu #62
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: Publish shadowsocks-rust container images based on Ubuntu | |
on: | |
schedule: | |
- cron: '0 17 * * 2' | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
REGISTRY: ghcr.io | |
SHADOWSOCKS_RUST_VERSION: 1.14.3 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- cpu: cortex-a7 | |
platform: linux/arm/v7 | |
- cpu: cortex-a15 | |
platform: linux/arm/v7 | |
- cpu: krait | |
platform: linux/arm/v7 | |
- cpu: cortex-a57 | |
platform: linux/arm64 | |
- cpu: cortex-a72 | |
platform: linux/arm64 | |
fail-fast: false | |
permissions: | |
packages: write | |
steps: | |
- name: Docker on tmpfs | |
if: ${{matrix.platform == 'linux/arm/v7'}} | |
uses: JonasAlfredsson/docker-on-tmpfs@v1 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
config-inline: | | |
[worker.oci] | |
max-parallelism = 1 | |
- name: Log into registry ${{env.REGISTRY}} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{env.REGISTRY}} | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{env.REGISTRY}}/${{github.repository_owner}}/shadowsocks-rust | |
tags: | | |
type=raw,latest-${{matrix.cpu}} | |
type=raw,${{env.SHADOWSOCKS_RUST_VERSION}}-${{matrix.cpu}} | |
labels: | | |
org.opencontainers.image.title=shadowsocks-rust container image for ${{matrix.cpu}} based on Ubuntu | |
org.opencontainers.image.description=shadowsocks-rust container image ${{matrix.cpu}} based on Ubuntu | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
env: | |
CPU: ${{matrix.cpu}} | |
with: | |
context: '{{defaultContext}}:shadowsocks-rust' | |
platforms: ${{matrix.platform}} | |
push: ${{github.event_name != 'pull_request'}} | |
tags: ${{steps.meta.outputs.tags}} | |
labels: ${{steps.meta.outputs.labels}} | |
build-args: | | |
SHADOWSOCKS_RUST_VERSION | |
CPU |