Skip to content

added cargo release #114

added cargo release

added cargo release #114

Workflow file for this run

name: Docker
on:
pull_request:
push:
branches:
- main
tags:
- '*'
env:
CARGO_TERM_COLOR: always
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install docker for macos
if: startsWith(matrix.os, 'macos-')
uses: douglascamata/setup-docker-macos-action@v1-alpha
- name: Databases
run: docker compose up -d
- name: Run tests
run: cargo test --verbose
build-and-releas:
name: build and release docker
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
if: startsWith(github.ref, 'refs/tags/') == false
run: docker build -t geni .
- name: Build Tag
if: startsWith(github.ref, 'refs/tags/')
run: docker build -t ghcr.io/${{ github.repository }}:${{ github.ref_name }} .
- name: Push Tagged Image
if: startsWith(github.ref, 'refs/tags/')
run: docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }}
- name: "Set latest tag"
id: set-latest-tag
run: echo "latest_tag=$(git tag | sort --version-sort | tail -n1)" >> $GITHUB_ENV
- name: Push Latest Image
if: ${{ github.ref_name == env.latest_tag }}
run: |
docker tag ghcr.io/${{ github.repository }}:${{ github.ref_name }} ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:latest