Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI/CD - Auto build, and auto-generate release notes #474

Merged
merged 7 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/on-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: On Tag - Release

on:
push:
tags:
- 'v*.*.*'
- 'v*.*.*-*'

jobs:
debug-print:
name: <Debug> Branch/tag - ${{github.ref}}
steps:
- name: step1
id: step1
run: |
echo "no-op"

build-psibase:
name: Run Builds
uses: ./.github/workflows/ubuntu-builder.yml

prerelease-check:
name: Prerelease Check
runs-on: ubuntu-latest
outputs:
prerelease: ${{ steps.set-prerelease-var.outputs.prerelease }}
steps:
- name: Set prerelease variable
id: set-prerelease-var
shell: bash
run: |
if [[ ${{ github.ref_name }} == *-* ]]; then
echo prerelease=true >>$GITHUB_OUTPUT
else
echo prerelease=false >>$GITHUB_OUTPUT
fi

create-psibase-release:
name: Create Psibase Release
needs:
- build-psibase
- prerelease-check
steps:
- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Download build artifacts
uses: actions/download-artifact@v3

- name: <Debug> Display structure of downloaded files
run: ls -R

- name: Create new Github Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
psidk-ubuntu-2004.tar.gz
psidk-ubuntu-2204.tar.gz
psidk-book.tar.gz
draft: true
prerelease: ${{needs.prerelease-check.outputs.prerelease}}
release_name: ${{ github.ref_name }}
tag_name: ${{ github.ref }}
body_path: ${{ steps.build_changelog.outputs.changelog }}
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
#token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


# build-new-CLI-versions:
# name: Build new CLI version
# needs: create-psibase-release
# runs-on: ubuntu-latest
# steps:
# - env:
# GITHUB_TOKEN: ${{ secrets.WORKFLOW_DISPATCHER_TOKEN }}
# run: |
# version=${{ github.ref_name }}
# gh workflow run cli.yml -f version=$version -R ${{ github.repository_owner }}/image-builders

# TODO: Psinode image is still taking the binaries from rolling-release. Needs to be changed to
# Download the artifacts from the release that I just uploaded to.
14 changes: 14 additions & 0 deletions .github/workflows/on-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: On Update - Build
on:
workflow_dispatch:
push:
branches:
- main
- "release/*"
pull_request:
types: [assigned, opened, synchronize, reopened, labeled]

jobs:
build:
name: Run Builds
uses: ./.github/workflows/ubuntu-builder.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull Request
name: Submodule regression
on: [pull_request]

env:
Expand Down
84 changes: 0 additions & 84 deletions .github/workflows/ubuntu-2004.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
name: Ubuntu 22.04
on:
workflow_dispatch:
push:
branches:
- main
- "release/*"
pull_request:
types: [assigned, opened, synchronize, reopened, labeled]
name: Ubuntu builds

env:
UBUNTU_2204_IMAGE: "ghcr.io/gofractally/psibase-builder-ubuntu-2204:7e3c6e5739df95ba33943789d2cdf5472f91111a"
on:
workflow_call:

jobs:
ubuntu-2204-build:
name: Ubuntu 22.04 | Build
build:
name: Ubuntu ${{ matrix.ubuntu-version }} - Build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- builder-image: "ghcr.io/${{ github.repository_owner }}/psibase-builder-ubuntu-2004:b2a46a609b12f645aaeb03245afd0e3d2bf75340"
ubuntu-version: "2004"
- builder-image: "ghcr.io/${{ github.repository_owner }}/psibase-builder-ubuntu-2204:7e3c6e5739df95ba33943789d2cdf5472f91111a"
ubuntu-version: "2204"
steps:
- name: Timestamp
id: ccache_cache_timestamp
Expand All @@ -28,9 +27,9 @@ jobs:
uses: actions/cache@v3
with:
path: .caches
key: $ubuntu-22.04-caches-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
key: $ubuntu-${{ matrix.ubuntu-version }}-caches-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
$ubuntu-22.04-caches-
$ubuntu-${{ matrix.ubuntu-version }}-caches-
- name: Build
run: |
set -e
Expand All @@ -46,9 +45,10 @@ jobs:
echo log_file = ${GITHUB_WORKSPACE}/ccache.log >>${GITHUB_WORKSPACE}/ccache.conf
export SCCACHE_CACHE_SIZE=200M
export RUSTC_WRAPPER=sccache
export DOCKER="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER --user $(id -u):$(id -g) ${UBUNTU_2204_IMAGE}"
export DOCKER_ROOT="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER ${UBUNTU_2204_IMAGE}"
docker pull ${UBUNTU_2204_IMAGE}
export DOCKER="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER --user $(id -u):$(id -g) ${{ matrix.builder-image }}"
export DOCKER_ROOT="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER ${{ matrix.builder-image }}"

docker pull ${{ matrix.builder-image }}
echo =====
${DOCKER} ccache -s
echo =====
Expand All @@ -68,14 +68,14 @@ jobs:
echo =====
${DOCKER} sccache -s
echo =====
${DOCKER} bash -c "cd build && cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=psidk-ubuntu-2204"
${DOCKER} bash -c "cd build && cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=psidk-ubuntu-${{ matrix.ubuntu-version }}"
echo =====
${DOCKER} bash -c "cd build && mv book psidk-book && tar czf ../psidk-book.tar.gz psidk-book"
- name: Upload psidk-ubuntu-2204
- name: Upload psidk-ubuntu-${{ matrix.ubuntu-version }}
uses: actions/upload-artifact@v1
with:
name: psidk-ubuntu-2204
path: build/psidk-ubuntu-2204.tar.gz
name: psidk-ubuntu-${{ matrix.ubuntu-version }}
path: build/psidk-ubuntu-${{ matrix.ubuntu-version }}.tar.gz
- name: Upload psidk-book
uses: actions/upload-artifact@v1
with:
Expand Down
Loading