From 4e4d8f3fb2108227426c28f05649eb67a78d180e Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 7 Apr 2023 03:10:00 -0400 Subject: upload container images to ghcr --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77c8e11..43b5dd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,11 +17,19 @@ on: jobs: build: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + strategy: matrix: output: [teawiebot, container] - runs-on: ubuntu-latest + env: + REGISTRY: ghcr.io + steps: - uses: actions/checkout@v3 @@ -29,5 +37,21 @@ jobs: with: github_access_token: ${{ secrets.GITHUB_TOKEN }} - - run: | + - name: login to ghcr + if: ${{ matrix.output == 'container' && github.ref == 'refs/heads/main' }} + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: "getchoo" + password: ${{ secrets.GITHUB_TOKEN }} + + - name: build + run: | nix build .#${{ matrix.output }} + + - name: upload to ghcr + if: ${{ matrix.output == 'container' && github.ref == 'refs/heads/main' }} + run: | + docker load < result + docker tag teawiebot:latest ghcr.io/getchoo/teawiebot:latest + docker push ghcr.io/getchoo/teawiebot:latest -- cgit v1.2.3