Skip to content

Attempt to reuse the atom for usages slicing (#98) #14

Attempt to reuse the atom for usages slicing (#98)

Attempt to reuse the atom for usages slicing (#98) #14

Workflow file for this run

name: Upload Container image
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch: # allow to manually trigger this workflow
env:
REGISTRY: ghcr.io
IMAGE_NAME: appthreat/atom
jobs:
deploy:
if: github.repository_owner == 'appthreat'
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '21.x'
- name: Delete `.rustup` directory
run: rm -rf /home/runner/.rustup # to save disk space
if: runner.os == 'Linux'
- name: Delete `.cargo` directory # to save disk space
run: rm -rf /home/runner/.cargo
if: runner.os == 'Linux'
- uses: actions/cache@v3
with:
path: |
~/.sbt
~/.coursier
key: ${{ runner.os }}-sbt-${{ hashfiles('**/build.sbt') }}
- run: |
git apply --ignore-space-change --ignore-whitespace contrib/java21.patch
if [ $? != 0 ]; then
echo "Unable to patch the codebase correctly."
exit 1
fi
sbt stage createDistribution
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/#-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/appthreat/atom
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
file: ci/Dockerfile
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=atom
cache-to: type=gha,mode=max,scope=atom
- name: Upload atom to ghcr
run: |
cd target
cp atom.zip atom-java21.zip
sha512sum atom.zip > atom.zip.sha512
sha512sum atom-java21.zip > atom-java21.zip.sha512
echo $GITHUB_TOKEN | oras login ghcr.io -u $GITHUB_USERNAME --password-stdin
oras push ghcr.io/appthreat/atom-java21: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
with:
files: |
target/atom-java21.zip
target/atom-java21.zip.sha512