Skip to content

Changing aarch docker image (#613) #1

Changing aarch docker image (#613)

Changing aarch docker image (#613) #1

name: CD
on:
push:
branches:
- master
permissions:
contents: write
env:
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
# github token to deploy the binary
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
jobs:
primary_release:
runs-on: ubuntu-22.04
outputs:
APP_VERSION: ${{ steps.set_app_version.outputs.APP_VERSION }}
steps:
- name: Explain
run: |
echo "Releases the Jar and Linux AMD64 version"
- name: Install Deps
run: sudo apt-get install docker-compose -y
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set app version
id: set_app_version
run: ./gradlew setVersionOnActions
- name: Check already released
run: git rev-parse "${APP_VERSION}^{}" >/dev/null 2>&1 && echo "> Already released" && exit 3 || echo "Not released yet"
- name: Jar and Linux AMD64 Release
run: |
mkdir -p ./build/ \
&& docker-compose -f docker-compose-deploy.yml up --build --force-recreate --exit-code-from deploy deploy \
&& ls -lhS ./build/*
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: native-image-source
path: ./build/artifacts/native-image-source/dns-proxy-server.jar
- name: Latest version changelog extraction
uses: kemayo/actions-recent-changelog@v1
with:
input: RELEASE-NOTES.md
output: VERSION-RELEASE-NOTES.md
- name: Check Release Notes
run: cat ./VERSION-RELEASE-NOTES.md
- name: Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.APP_VERSION }}
prerelease: true
body_path: VERSION-RELEASE-NOTES.md
files: |
./build/compressed-artifacts/*
linux_amd64_static_release:
runs-on: ubuntu-22.04
needs: primary_release
env:
APP_VERSION: ${{ needs.primary_release.outputs.APP_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check app version
run: echo "$APP_VERSION"
- name: Install Deps
run: sudo apt-get install rename docker-compose -y
- uses: actions/download-artifact@v3
with:
name: native-image-source
path: ./build/artifacts/native-image-source/
- name: Linux Amd64 static Release
run: |
echo "app version=$APP_VERSION" &&\
tree -h ./build/ &&\
docker-compose -f docker-compose-deploy.yml run deploy bash -c '
/bin/builder.bash deploy-amd64-static &&\
echo "> Copying files to the host" &&\
cp -rv /app/build/compressed-artifacts /host/build/ &&\
echo "Linux amd64 static is done!"
' &&\
tree -h ./build/
# Release details will be provided by primary-release
- name: Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.APP_VERSION }}
append_body: true
body: ''
files: |
./build/compressed-artifacts/*
linux_arm_release:
runs-on: ubuntu-22.04
needs: primary_release
env:
APP_VERSION: ${{ needs.primary_release.outputs.APP_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check app version
run: echo "$APP_VERSION"
- name: Install Deps
run: sudo apt-get install rename docker-compose -y
- uses: actions/download-artifact@v3
with:
name: native-image-source
path: ./build/artifacts/native-image-source/
- name: Latest Qemu binaries (8.2x)
run: |
docker-compose -f docker-compose-qemu.yaml build --progress=plain
- name: Configure Qemu With Docker
run: docker run --rm --privileged defreitas/qemu-user-static --reset -p yes
- name: Linux Arm Release
run: |
echo "app version=$APP_VERSION" &&\
tree -h ./build/ &&\
docker-compose -f docker-compose-deploy.yml run deploy bash -c '
/bin/builder.bash deploy-arm &&\
echo "> Copying files to the host" &&\
cp -rv /app/build/compressed-artifacts /host/build/ &&\
echo "Linux arm64 is done!"
' &&\
tree -h ./build/
# Release details will be provided by primary-release
- name: Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.APP_VERSION }}
append_body: true
body: ''
files: |
./build/compressed-artifacts/*
aditional_release:
name: ${{ matrix.os }} release
needs: primary_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
# disabling mac as the binary isn't working macos-latest, see #341
env:
APP_VERSION: ${{ needs.primary_release.outputs.APP_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: native-image-source
path: ./build/artifacts/native-image-source/
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Os Report ${{ matrix.os }}
run: |
echo "> Building binary for: ${RUNNER_OS}-${RUNNER_ARCH}" &&\
mkdir tmp &&\
mkdir -p ./build/artifacts/${RUNNER_OS}-${RUNNER_ARCH} ./build/compressed-artifacts/${RUNNER_OS}-${RUNNER_ARCH}
shell: bash
- name: build native-image binary ${{ matrix.os }}
if: runner.os == 'Windows'
run: |
${GRAALVM_HOME}/bin/native-image.cmd \
-H:+AddAllCharsets \
-H:ServiceLoaderFeatureExcludeServices=java.net.ContentHandlerFactory \
-jar ./build/artifacts/native-image-source/dns-proxy-server.jar ./tmp/dns-proxy-server
shell: bash
- name: build native-image binary ${{ matrix.os }}
if: runner.os == 'macOS'
run: native-image -jar ./build/artifacts/native-image-source/dns-proxy-server.jar ./tmp/dns-proxy-server
- name: build native-image binary ${{ matrix.os }}
run: |
ls -lhS ./tmp &&\
mv ./tmp/* ./build/artifacts/${RUNNER_OS}-${RUNNER_ARCH}/ &&\
7z a -tzip ./build/compressed-artifacts/dns-proxy-server-${RUNNER_OS}-${RUNNER_ARCH}-${APP_VERSION}.zip ./build/artifacts/${RUNNER_OS}-${RUNNER_ARCH}
shell: bash
# Release details will be provided by primary-release
- name: Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.APP_VERSION }}
append_body: true
body: ''
files: |
./build/compressed-artifacts/*