Skip to content

Commit

Permalink
ci: add nightly build flow
Browse files Browse the repository at this point in the history
Former-commit-id: 0502a4b
  • Loading branch information
moabu committed Mar 23, 2023
1 parent fccb76a commit 794bc28
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/activate-nightly-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Activate Nightly Build

on:
workflow_dispatch:
schedule:
- cron: "0 23 * * *"
jobs:
publish_binary_packages:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: set nightly version
id: nightly
continue-on-error: false
if: ${{ github.event_name }} == 'schedule' || ${{ github.event.inputs.nightly }} == 'true'
run: |
VERSION=`curl "https://api.github.com/repos/cli/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c2-`
echo $VERSION
curl -sSL https://github.com/cli/cli/releases/download/v${VERSION}/gh_${VERSION}_linux_amd64.tar.gz -o gh_${VERSION}_linux_amd64.tar.gz
tar xvf gh_${VERSION}_linux_amd64.tar.gz
sudo cp gh_${VERSION}_linux_amd64/bin/gh /usr/local/bin/
gh version
echo "${{ secrets.MOAUTO_WORKFLOW_TOKEN }}" | gh auth login --with-token
NIGHTLY_VERSION=$(cat docker-jans-auth-server/Dockerfile | grep "ENV CN_VERSION" | awk -F "[=-]" '{print $2}')
gh release delete v${NIGHTLY_VERSION}_nightly --cleanup-tag --yes || echo "v${NIGHTLY_VERSION}_nightly" does not exist
gh release create v${NIGHTLY_VERSION}_nightly --generate-notes --prerelease --title "v${NIGHTLY_VERSION}_nightly"
34 changes: 2 additions & 32 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,6 @@ jobs:
python_version: 3.6

steps:
- name: Checkout
uses: actions/checkout@v3

- name: set nightly version
id: nightly
continue-on-error: false
if: ${{ github.event_name }} == 'schedule' || ${{ github.event.inputs.nightly }} == 'true'
run: |
VERSION=`curl "https://api.github.com/repos/cli/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c2-`
echo $VERSION
curl -sSL https://github.com/cli/cli/releases/download/v${VERSION}/gh_${VERSION}_linux_amd64.tar.gz -o gh_${VERSION}_linux_amd64.tar.gz
tar xvf gh_${VERSION}_linux_amd64.tar.gz
sudo cp gh_${VERSION}_linux_amd64/bin/gh /usr/local/bin/
gh version
echo "${{ secrets.MOAUTO_WORKFLOW_TOKEN }}" | gh auth login --with-token
NIGHTLY_VERSION=$(cat docker-jans-auth-server/Dockerfile | grep "ENV CN_VERSION" | awk -F "[=-]" '{print $2}')
gh release delete v$NIGHTLY_VERSION-nightly --cleanup-tag --yes || echo "v$NIGHTLY_VERSION-nightly" does not exist
gh release create v$NIGHTLY_VERSION-nightly --generate-notes --prerelease --title "v$NIGHTLY_VERSION-nightly"
echo "nightlyversion=$NIGHTLY_VERSION" >> $GITHUB_OUTPUT
- name: Getting build dependencies
id: get_dependencies
run: |
Expand Down Expand Up @@ -105,7 +85,7 @@ jobs:
#If on schedule build nightly packages
if [ ${{ github.event_name }} = "schedule" ] || [ ${{ github.event.inputs.nightly }} = true ]; then
echo "Activating nightly build"
TAG=${{ steps.nightly.outputs.nightlyversion }}
TAG=$(curl https://api.github.com/repos/${{ github.repository }}/releases -s | grep "tag_name" | grep "nightly" | cut -d '"' -f 4 | grep -o '^\v.*' | head -n 1)
mkdir test && cd test
git clone https://github.com/JanssenProject/jans
VERSION=$(cat jans/docker-jans-auth-server/Dockerfile | grep "ENV CN_VERSION" | awk -F "[=-]" '{print $2}')
Expand Down Expand Up @@ -249,16 +229,6 @@ jobs:
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-ubuntu-X86-64.pyz
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-ubuntu-X86-64.pyz.sha256sum
key: ${{ github.sha }}
- name: set nightly version
id: nightly
continue-on-error: false
if: ${{ github.event_name }} == 'schedule' || ${{ github.event.inputs.nightly }} == 'true'
run: |
echo "${{ secrets.MOAUTO_WORKFLOW_TOKEN }}" | gh auth login --with-token
NIGHTLY_VERSION=$(cat docker-jans-auth-server/Dockerfile | grep "ENV CN_VERSION" | awk -F "[=-]" '{print $2}')
gh release delete v$NIGHTLY_VERSION-nightly --cleanup-tag --yes || echo "v$NIGHTLY_VERSION-nightly" does not exist
gh release create v$NIGHTLY_VERSION-nightly --generate-notes --prerelease --title "v$NIGHTLY_VERSION-nightly"
echo "nightlyversion=$NIGHTLY_VERSION" >> $GITHUB_OUTPUT
- name: Get latest tag
id: previoustag
run: |
Expand All @@ -268,7 +238,7 @@ jobs:
#If on schedule build nightly packages
if [ ${{ github.event_name }} = "schedule" ] || [ ${{ github.event.inputs.nightly }} = true ]; then
echo "Activating nightly build"
TAG=${{ steps.nightly.outputs.nightlyversion }}
TAG=$(curl https://api.github.com/repos/${{ github.repository }}/releases -s | grep "tag_name" | grep "nightly" | cut -d '"' -f 4 | grep -o '^\v.*' | head -n 1)
VERSION=$(cat docker-jans-auth-server/Dockerfile | grep "ENV CN_VERSION" | awk -F "[=-]" '{print $2}')
echo "SETUP_PREFIX=jans-linux-$VERSION-nightly-build" >> ${GITHUB_ENV}
echo "TUI_PREFIX=jans-cli-tui-linux-$VERSION-nightly-build" >> ${GITHUB_ENV}
Expand Down
4 changes: 2 additions & 2 deletions docker-jans-monolith/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:22.04

# Don't start any optional services except for the few we need.
RUN find /etc/systemd/system \
Expand All @@ -16,7 +16,7 @@ RUN echo 'APT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/00-docker \
# Prevent prompt errors during package installation
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update \
&& apt-get install -y python3 tini curl ca-certificates dbus systemd iproute2 gpg python3-pip python3-dev libpq-dev gcc \
&& apt-get install -y python3 tini curl ca-certificates dbus systemd iproute2 gpg python3-pip python3-dev libpq-dev gcc python3-psycopg2 python3-ldap3 \
&& apt-get clean \
# Cleaning up package lists
&& rm -rf /var/lib/apt/lists/*
Expand Down

0 comments on commit 794bc28

Please sign in to comment.