From e0b19f8eb4c5dca9fcb48253743afdadd720a37b Mon Sep 17 00:00:00 2001 From: DataHearth Date: Fri, 30 Jun 2023 11:36:36 +0200 Subject: [PATCH] migrate github actions to gitea --- .gitea/workflows/container.yml | 31 ++++++++++++++++++----- .gitea/workflows/rust.yml | 4 +++ .github/workflows/container.yml | 45 --------------------------------- .github/workflows/rust.yml | 21 --------------- 4 files changed, 29 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/container.yml delete mode 100644 .github/workflows/rust.yml diff --git a/.gitea/workflows/container.yml b/.gitea/workflows/container.yml index 7447f63..0441146 100644 --- a/.gitea/workflows/container.yml +++ b/.gitea/workflows/container.yml @@ -1,15 +1,23 @@ name: Docker +run-name: Build and push Docker image + on: push: - tags: ["v*.*.*"] + tags: + - "v*.*.*" env: - REGISTRY: gitea.antoine-langlois.net + GITEA_REGISTRY: gitea.antoine-langlois.net + GH_REGISTRY: ghcr.io + GH_REPOSITORY: wyll-io/tech-bot + GITEA_REPOSITORY: datahearth/tech-bot jobs: build-push: + name: Build and push Docker image runs-on: debian-docker + steps: - name: Checkout uses: actions/checkout@v3 @@ -26,17 +34,25 @@ jobs: - name: Log into registry Gitea uses: docker/login-action@v2 with: - registry: ${{ env.REGISTRY }} + registry: ${{ env.GITEA_REGISTRY }} username: ${{ gitea.repository_owner }} password: ${{ secrets.REGISTRY_TOKEN }} + - name: Log into registry GitHub + uses: docker/login-action@v2 + with: + registry: ${{ env.GH_REGISTRY }} + username: ${{ gitea.repository_owner }} + password: ${{ secrets.GH_REGISTRY_TOKEN }} + - name: Extract Docker metadata id: meta uses: docker/metadata-action@v4 with: images: | - ${{ gitea.repository }} - ${{ env.REGISTRY }}/${{ gitea.repository }} + ${{ env.GITEA_REPOSITORY }} + ${{ env.GITEA_REGISTRY }}/${{ env.GITEA_REPOSITORY }} + ${{ env.GH_REGISTRY }}/${{ env.GH_REPOSITORY }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} @@ -48,6 +64,9 @@ jobs: context: . push: true cache-to: type=inline - cache-from: type=registry,ref=datahearth/tech-bot:latest + cache-from: | + type=registry,ref=${{ env.GITEA_REPOSITORY }}:latest + type=registry,ref=${{ env.GITEA_REGISTRY }}/${{ env.GITEA_REPOSITORY }}:latest + type=registry,ref=${{ env.GH_REGISTRY }}/${{ env.GH_REPOSITORY }}:latest tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitea/workflows/rust.yml b/.gitea/workflows/rust.yml index 64aba38..8aeaa08 100644 --- a/.gitea/workflows/rust.yml +++ b/.gitea/workflows/rust.yml @@ -1,5 +1,7 @@ name: Rust +run-name: Run Rust commands + on: push: branches: @@ -13,7 +15,9 @@ env: jobs: test: + name: Run tests runs-on: debian-rust + steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml deleted file mode 100644 index 4aafcbd..0000000 --- a/.github/workflows/container.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Docker - -on: - push: - tags: ["v*.*.*"] - -env: - REGISTRY: ghcr.io - -jobs: - build-push: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Docker buildx - uses: docker/setup-buildx-action@v2 - - - name: Log into registry GitHub - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: DataHearth - password: ${{ secrets.REGISTRY_TOKEN }} - - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.REGISTRY }}/${{ github.repository }} - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - - - name: Build and push Docker image - id: build-and-push - uses: docker/build-push-action@v4 - with: - context: . - push: true - cache-to: type=inline - cache-from: type=registry,ref=datahearth/tech-bot:latest - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 8ef5a62..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Rust - -on: - push: - branches: - - "main" - pull_request: - branches: - - "main" - -env: - CARGO_TERM_COLOR: always - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Run tests - run: cargo test --verbose