unshift tasks #58
Workflow file for this run
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: Docker | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: ["main"] | |
tags: | |
- "v*" | |
pull_request: | |
branches: ["main"] | |
env: | |
NODE_VERSION: 20.x | |
SQLX_OFFLINE: true | |
jobs: | |
build_binaries: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
strategy: | |
matrix: | |
include: | |
- rust_target: "aarch64-unknown-linux-musl" | |
docker_tag: "aarch64-musl" | |
artifact_name: "arm64" | |
- rust_target: "armv7-unknown-linux-musleabihf" | |
docker_tag: "armv7-musleabihf" | |
artifact_name: "armv7" | |
- rust_target: "x86_64-unknown-linux-musl" | |
docker_tag: "x86_64-musl" | |
artifact_name: "amd64" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: "pnpm" | |
- run: pnpm install --frozen-lockfile --prefer-offline | |
- run: pnpm run build --scope=@pointguard/web-ui | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.rust_target }} | |
- name: build binary | |
run: | | |
docker run -e SQLX_OFFLINE=true --rm -v "$(pwd)":/home/rust/src messense/rust-musl-cross:${{matrix.docker_tag}} \ | |
cargo build --release --bin pointguard_cli | |
docker run -e SQLX_OFFLINE=true --rm -v "$(pwd)":/home/rust/src messense/rust-musl-cross:${{matrix.docker_tag}} \ | |
musl-strip target/${{matrix.rust_target}}/release/pointguard_cli | |
- name: store binary artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
path: target/${{matrix.rust_target}}/release/pointguard_cli | |
name: ${{matrix.artifact_name}} | |
docker: | |
needs: | |
- build_binaries | |
permissions: | |
contents: read | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
path: releases | |
- name: list directories | |
run: | | |
ls -R | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=sha | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |