Skip to content

add feature, download artifacts #791

add feature, download artifacts

add feature, download artifacts #791

Workflow file for this run

name: workflow
on:
push:
tags:
- '*.*.*'
branches:
- '**'
pull_request:
branches:
- main
jobs:
build-ng:
runs-on: ubuntu-latest
env:
TZ: Europe/Amsterdam
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci --ignore-scripts --legacy-peer-deps
- run: npm run test
build-rs:
runs-on: ubuntu-latest
env:
TZ: Europe/Amsterdam
defaults:
run:
working-directory: ./api
steps:
- uses: actions/checkout@v4
- run: cargo build --verbose
- run: cargo test --verbose
- run: cargo clippy --verbose -- -D warnings
build-docker:
if: github.event_name != 'pull_request'
needs: [build-rs, build-ng]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
REF_NAME="${{ github.ref_name }}"
REF_NAME_LOWER=$(echo "$REF_NAME" | tr '[:upper:]' '[:lower:]')
REF_NAME_CLEAN=$(echo "$REF_NAME_LOWER" | tr -cd '[:alnum:]._-')
REF_NAME_CLEAN=$(echo "$REF_NAME_CLEAN" | sed 's/^[^a-z0-9]*//;s/[^a-z0-9]*$//')
if [[ ! "$REF_NAME_CLEAN" =~ ^[a-z0-9] ]]; then
REF_NAME_CLEAN="0$REF_NAME_CLEAN"
fi
echo "CLEANED_REF_NAME=$REF_NAME_CLEAN" >> $GITHUB_ENV
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v6
if: startsWith(github.ref, 'refs/tags/')
with:
push: true
tags: ${{ github.repository }}:latest,${{ github.repository }}:${{ github.ref_name }}
build-args: VERSION_ARG=v${{ github.ref_name }}
- uses: docker/build-push-action@v6
if: startsWith(github.ref, 'refs/heads/')
with:
push: true
tags: ${{ github.repository }}:${{ env.CLEANED_REF_NAME }}
build-args: VERSION_ARG=${{ github.sha }}@${{ env.CLEANED_REF_NAME }}
- uses: peter-evans/dockerhub-description@v4
if: github.ref == 'refs/heads/main'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ github.repository }}
short-description: ${{ github.event.repository.description }}