From 4c4aea71b985643f5239344fb43723c8600fd00d Mon Sep 17 00:00:00 2001 From: Prabhu Subramanian Date: Fri, 10 Nov 2023 22:39:50 +0000 Subject: [PATCH] Publish oci to ghcr Signed-off-by: Prabhu Subramanian --- .github/workflows/release.yml | 15 +++++++++++++++ ci/annotations.json | 8 ++++++++ ci/config.json | 4 ++++ 3 files changed, 27 insertions(+) create mode 100644 ci/annotations.json create mode 100644 ci/config.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc8ae9f..1b21fbe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,8 +4,12 @@ on: tags: - 'v*' workflow_dispatch: # allow to manually trigger this workflow +env: + REGISTRY: ghcr.io + IMAGE_NAME: appthreat/atom jobs: release: + if: github.repository_owner == 'appthreat' concurrency: release runs-on: ubuntu-latest permissions: @@ -26,6 +30,17 @@ jobs: sha512sum target/atom.zip > target/atom.zip.sha512 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload atom to ghcr + run: | + cd target + echo $GITHUB_TOKEN | oras login ghcr.io -u $GITHUB_USERNAME --password-stdin + oras push ghcr.io/$IMAGE_NAME:v1 \ + --annotation-file ../ci/annotations.json \ + ./atom.zip:application/vnd.appthreat.atom.layer.v1+tar \ + ./atom.zip.sha512:application/vnd.appthreat.atom.layer.v1+tar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_USERNAME: ${{ github.actor }} - name: Create Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 diff --git a/ci/annotations.json b/ci/annotations.json new file mode 100644 index 0000000..b9a7f3e --- /dev/null +++ b/ci/annotations.json @@ -0,0 +1,8 @@ +{ + "$config": { + "org.opencontainers.image.title": "atom", + "org.opencontainers.image.vendor": "appthreat", + "org.opencontainers.image.licenses": "Apache-2.0", + "org.opencontainers.image.description": "Create atom (⚛) representation for your application, packages and libraries" + } +} diff --git a/ci/config.json b/ci/config.json new file mode 100644 index 0000000..bd5aa95 --- /dev/null +++ b/ci/config.json @@ -0,0 +1,4 @@ +{ + "product": "atom", + "vendor": "appthreat" +}