[ci] Improve CI scripts

This commit is contained in:
Laura Hausmann 2024-04-11 21:18:52 +02:00
parent 20aca1c8b0
commit b6b1430cb9
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
3 changed files with 17 additions and 7 deletions

View file

@ -1,6 +1,7 @@
on: on:
release: push:
types: [published] tags:
- '*'
jobs: jobs:
unit-tests: unit-tests:
runs-on: docker runs-on: docker
@ -8,7 +9,7 @@ jobs:
image: mcr.microsoft.com/dotnet/sdk:8.0-alpine image: mcr.microsoft.com/dotnet/sdk:8.0-alpine
steps: steps:
- name: Clone repository - name: Clone repository
run: git clone https://iceshrimp.dev/iceshrimp/Iceshrimp.NET.git --branch=${{ github.ref_name }} --depth=1 /iceshrimp run: git clone ${{ github.event.repository.clone_url }} --branch=${{ github.ref_name }} --depth=1 /iceshrimp
- name: Run unit tests - name: Run unit tests
run: | run: |
cd /iceshrimp cd /iceshrimp
@ -41,11 +42,15 @@ jobs:
registry: iceshrimp.dev registry: iceshrimp.dev
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
- name: Set environment variables
shell: bash
run: |
echo "REPO=${GITHUB_REPOSITORY@L}" >> "${GITHUB_ENV}"
- name: Build and push - name: Build and push
uses: https://code.forgejo.org/docker/build-push-action@v5 uses: https://code.forgejo.org/docker/build-push-action@v5
with: with:
push: true push: true
tags: iceshrimp.dev/iceshrimp/iceshrimp.net:${{ github.event.release.name }} tags: iceshrimp.dev/${{ env.REPO }}:${{ github.ref_name }}
target: image-aot target: image-aot
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
provenance: false provenance: false

View file

@ -9,7 +9,7 @@ jobs:
image: mcr.microsoft.com/dotnet/sdk:8.0-alpine image: mcr.microsoft.com/dotnet/sdk:8.0-alpine
steps: steps:
- name: Clone repository - name: Clone repository
run: git clone https://iceshrimp.dev/iceshrimp/Iceshrimp.NET.git --branch=${{ github.ref_name }} --depth=1 /iceshrimp run: git clone ${{ github.event.repository.clone_url }} --branch=${{ github.ref_name }} --depth=1 /iceshrimp
- name: Run unit tests - name: Run unit tests
run: | run: |
cd /iceshrimp cd /iceshrimp
@ -42,11 +42,16 @@ jobs:
registry: iceshrimp.dev registry: iceshrimp.dev
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
- name: Set environment variables
shell: bash
run: |
echo "REPO=${GITHUB_REPOSITORY@L}" >> "${GITHUB_ENV}"
- name: Build and push - name: Build and push
uses: https://code.forgejo.org/docker/build-push-action@v5 uses: https://code.forgejo.org/docker/build-push-action@v5
with: with:
push: true push: true
tags: iceshrimp.dev/iceshrimp/iceshrimp.net:dev tags: iceshrimp.dev/${{ env.REPO }}:${{ github.ref_name }}
target: image-jit
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
provenance: false provenance: false
cache-from: type=local,src=/buildkit-cache cache-from: type=local,src=/buildkit-cache

View file

@ -9,7 +9,7 @@ jobs:
image: mcr.microsoft.com/dotnet/sdk:8.0-alpine image: mcr.microsoft.com/dotnet/sdk:8.0-alpine
steps: steps:
- name: Clone repository - name: Clone repository
run: git clone https://iceshrimp.dev/iceshrimp/Iceshrimp.NET.git --branch=${{ github.ref_name }} --depth=1 /iceshrimp run: git clone ${{ github.event.repository.clone_url }} --branch=${{ github.ref_name }} --depth=1 /iceshrimp
- name: Build backend & frontend - name: Build backend & frontend
run: | run: |
cd /iceshrimp/Iceshrimp.Backend cd /iceshrimp/Iceshrimp.Backend