From c647453940b18eb978df9f0473b6e2ed9c6c3c5d Mon Sep 17 00:00:00 2001 From: Zeke Mostov Date: Wed, 21 Feb 2024 16:18:27 -0500 Subject: [PATCH] Add upload to GHCR step --- .github/workflows/stage.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index 0c3881f7..b3220794 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -78,3 +78,40 @@ jobs: name: ${{ matrix.target }} path: out/${{ matrix.target }} retention-days: 1 + + upload_to_ghcr: + name: Upload toolchain artifacts to GHCR + runs-on: ubuntu-latest + needs: + - build + permissions: + contents: read + packages: write + steps: + - name: Download Artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + - name: Upload images to GHCR + env: + images: >- + qos_client + qos_enclave + qos_host + tags: >- + ${{ github.ref == format('refs/heads/{0}', 'main') && 'latest' || '' }} + ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || '' }} + ${{ github.event_name == 'push' && github.ref_name || '' }} + run: | + skopeo login \ + --username "${{ github.actor }}" \ + --password "${{ secrets.GITHUB_TOKEN }}" \ + ghcr.io + for image in ${images}; do + skopeo copy --all \ + "oci-archive:./${image}.oci.x86_64.tar/${image}.oci.x86_64.tar" \ + "docker://ghcr.io/tkhq/${image}:sha-${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" + for tag in ${tags}; do + skopeo copy --all \ + "docker://ghcr.io/tkhq/${image}:sha-${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" \ + "docker://ghcr.io/tkhq/${image}:${tag}" + done + done \ No newline at end of file