From cdc0d6b4be7c97b80c78b6f87d5f2e9c017a7ae7 Mon Sep 17 00:00:00 2001 From: DTieman Date: Sun, 14 Apr 2024 00:27:36 +0200 Subject: [PATCH] Replaced github action with gitea action --- .gitea/workflows/main.yaml | 73 ++++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 46 ------------------------ 2 files changed, 73 insertions(+), 46 deletions(-) create mode 100644 .gitea/workflows/main.yaml delete mode 100644 .github/workflows/main.yml diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml new file mode 100644 index 0000000..d1435f9 --- /dev/null +++ b/.gitea/workflows/main.yaml @@ -0,0 +1,73 @@ +name: Build Mau & Deploy Mau + +on: [push, pull_request] + +concurrency: + group: mau + cancel-in-progress: true + +env: + DOTNET_INSTALL_DIR: "./.dotnet" + DOCKER_LATEST: nightly + GITEA_INSTANCE_URL: "git.mau-mau.nl" + +jobs: + build: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + steps: + - name: Checkout + uses: actions/checkout@main + with: + fetch-depth: 0 + - name: Setup .NET Core + uses: actions/setup-dotnet@main + with: + dotnet-version: 7.0.x + - name: Install dependencies + run: dotnet restore + - name: Build + run: dotnet build --configuration Release --no-restore + - name: Test + run: dotnet test --no-restore --verbosity normal + deploy: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + needs: build + if: gitea.ref == 'refs/heads/mauster' + - name: Set up Docker BuildX + uses: docker/setup-buildx-action@v2 + with: + config-inline: | + [registry."${{ env.GITEA_INSTANCE_URL }}"] + http = true + insecure = true + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + registry: ${{ env.GITEA_INSTANCE_URL }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Get Meta + id: meta + run: | + echo REPO_OWNER=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $1}' ) >> $GITHUB_OUTPUT + echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT + echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + platforms: | + linux/amd64 + linux/arm64 + push: true + tags: | + ${{ env.GITEA_INSTANCE_URL }}/${{ steps.meta.outputs.REPO_OWNER }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} + ${{ env.GITEA_INSTANCE_URL }}/${{ steps.meta.outputs.REPO_OWNER }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 0bcb783..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Build Mau & Deploy Mau - -on: - push: - branches: - - mauster - pull_request: - branches: - - mauster - workflow_dispatch: - -concurrency: - group: mau - cancel-in-progress: true - -env: - DOTNET_INSTALL_DIR: "./.dotnet" - -jobs: - build: - runs-on: self-hosted - steps: - - name: Checkout - uses: actions/checkout@main - with: - fetch-depth: 0 - - name: Setup .NET Core - uses: actions/setup-dotnet@main - with: - dotnet-version: 7.0.x - - name: Install dependencies - run: dotnet restore - - name: Build - run: dotnet build --configuration Release --no-restore - - name: Test - run: dotnet test --no-restore --verbosity normal - deploy: - runs-on: self-hosted - needs: build - steps: - - name: Checkout - uses: actions/checkout@main - with: - fetch-depth: 0 - - name: Docker Compose - run: docker compose up -d --build