Pre-Release (Git) triggered by pvshvp-oss #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: π Pre-Release (Git) | |
run-name: Pre-Release (Git) triggered by ${{ github.actor }} | |
on: | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
build: | |
name: π Build | |
runs-on: ubuntu-latest | |
container: | |
image: rebornos/rebornos:latest | |
ports: | |
- 80 | |
steps: | |
- name: π Initialize RebornOS Docker Container | |
id: init_docker_step | |
run: sh /usr/bin/init-rebornos-docker.sh | |
- name: π Checkout Git Repository | |
id: checkout_repository_step | |
uses: actions/checkout@v3 | |
- name: π Build Package | |
id: build_package_step | |
run: | | |
chown -R rebornos packaging | |
chmod -R +x packaging | |
sudo -u rebornos sh -c "packaging/build_package.sh git --noconfirm" | |
- name: β¬ Upload Package Artifact | |
id: upload_package_step | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Unstable Package | |
path: packaging/${{ github.event.repository.name }}-git/${{ github.event.repository.name }}*.pkg.tar.* | |
if-no-files-found: error | |
release: | |
needs: build | |
name: π Pre-Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Checkout Git Repository | |
id: checkout_repository_step | |
uses: actions/checkout@v3 | |
- name: π· Determine Tags and Versions | |
id: set_versions_step | |
run: | | |
git fetch --prune --unshallow --tags -f | |
LATEST_TAG="$(git tag | grep -v -P '^v([0-9]+)\.([0-9]+)\.([0-9]+).*\.' | grep -v -P '^v([0-9]+)\.([0-9]+)\.([0-9]+).*\.' | grep -v -P '^v([0-9]+)\.([0-9]+)\.([0-9]+)_$' | sort --version-sort | tail -n1)" | |
GIT_VERSION="$(git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)")" | |
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV | |
echo "GIT_VERSION=$GIT_VERSION" >> $GITHUB_ENV | |
echo "LATEST_TAG=$LATEST_TAG" | |
echo "GIT_VERSION=$GIT_VERSION" | |
- name: β¬ Download Package Artifact | |
id: download_package_step | |
uses: actions/download-artifact@v3 | |
with: | |
name: Unstable Package | |
path: output | |
- name: π© Generate CheckSum | |
id: generate_checksum_step | |
run: | | |
cd ${{ steps.download_package_step.outputs.download-path }} | |
find . -type f -exec sh -c 'sha256sum "$0 > $0.sha256sum' {} \; | |
- name: π Create Pre-Release | |
id: create_release_step | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: true | |
fail_on_unmatched_files: true | |
generate_release_notes: true | |
append_body: false | |
tag_name: ${{ env.GIT_VERSION }} | |
name: ${{ env.GIT_VERSION }} | |
files: | | |
${{ steps.download_package_step.outputs.download-path }}/**${{ github.event.repository.name }}*.pkg.tar* |