Fix brackets #6
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: SnowID Extension | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- created | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
- name: Clippy | |
run: cargo clippy -- -D warnings | |
- name: Build | |
run: cargo build --verbose | |
publish_trunk: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
pg: [ 14, 15, 16, 17 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install pg-trunk | |
shell: bash | |
run: cargo install pg-trunk | |
- name: Trunk build | |
run: trunk build --pg-version ${{ matrix.pg }} | |
- name: Trunk publish | |
env: | |
TRUNK_API_TOKEN: ${{ secrets.TRUNK_AUTH_TOKEN }} | |
run: trunk publish snowid | |
build_and_push: | |
name: Build and push images | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
pg: [ 14, 15, 16, 17 ] | |
outputs: | |
short_sha: ${{ steps.versions.outputs.SHORT_SHA }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set version strings | |
id: versions | |
run: | | |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "TAG_VER=$(grep 'default_version' snowid.control | cut -d "'" -f 2)" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Generate dockerfile from template file | |
run: | | |
chmod +x ./public/scripts/test.sh | |
./images/snowid-cloudnative/replace-pg-version.sh ${{ matrix.pg }} ./images/snowid-cloudnative/in.Dockerfile ./images/snowid-cloudnative/Dockerfile | |
- name: Build and push -- Commit | |
# push commit build when not a release | |
if: startsWith(github.ref, 'refs/tags/') != true | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./images/snowid-cloudnative/Dockerfile | |
context: . | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
tags: | | |
qeeqez/snowid:v${{ steps.versions.outputs.SHORT_SHA }}-pg${{matrix.pg}} | |
- name: Build and push -- Releases | |
# only publish release events | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./images/snowid-cloudnative/Dockerfile | |
context: . | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
tags: | | |
qeeqez/snowid:v${{ steps.versions.outputs.TAG_VER }}-pg${{matrix.pg}} | |
qeeqez/snowid:latest-pg${{matrix.pg}} |