Create a new release #250
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: Create a new release | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
# releaseNumber: | |
# description: 'Release number' | |
# required: true | |
denoVersion: | |
description: 'Deno version (optional)' | |
required: false | |
#default: '1.23.2' # Remove this after Deno fix https://github.com/c4spar/deno-cliffy/issues/458 | |
# Check test.yml and checkSources.yml | |
jobs: | |
createRelease: | |
runs-on: ubuntu-latest | |
steps: | |
# - name: Check releaseNumber | |
# run: | | |
# version=$LEVAIN_VERSION | |
# if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
# echo Version v${version}; | |
# else | |
# echo Invalid version number - $version; | |
# echo | |
# echo You must use the pattern | |
# echo major.minor.patch | |
# echo | |
# echo Examples: | |
# echo 0.20.1 | |
# echo 1.0.3 | |
# echo 2.5.0 | |
# echo | |
# exit 1 | |
# fi | |
# env: | |
# LEVAIN_VERSION: ${{ github.event.inputs.releaseNumber }} | |
- name: Check denoVersion | |
run: | | |
version=${{ github.event.inputs.denoVersion }} | |
if [ -n "$version" ]; then | |
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo DenoVersion v${version}; | |
else | |
echo Invalid denoVersion - $version; | |
echo | |
echo You must use the pattern | |
echo major.minor.patch | |
echo | |
echo Examples: | |
echo 0.20.1 | |
echo 1.0.3 | |
echo 2.5.0 | |
echo | |
exit 1 | |
fi | |
fi | |
- name: Clean TEMP | |
run: rm -rf $RUNNER_TEMP && mkdir -p $RUNNER_TEMP | |
- name: Clean Workspace | |
run: rm -rf $GITHUB_WORKSPACE && mkdir -p $GITHUB_WORKSPACE | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Generate versions | |
uses: HardNorth/[email protected] | |
with: | |
version-source: file | |
version-file: ${{ github.workspace }}/recipes/levain.levain.yaml | |
version-file-extraction-pattern: 'version: (.+)' | |
- name: Echo version | |
run: | | |
echo CURRENT ${{ env.CURRENT_VERSION }} | |
echo LEVAIN_VERSION $LEVAIN_VERSION | |
echo NEXT ${{ env.NEXT_VERSION }} | |
env: | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
- name: Get Deno | |
run: | | |
rm -rf $DENO_ROOT_PATH && mkdir -p $DENO_ROOT_PATH | |
echo Deno Windows | |
bash $GITHUB_WORKSPACE/githubScripts/get-deno.sh $DENO_ROOT_PATH/windows Windows ${{ github.event.inputs.denoVersion }} | |
echo Deno Linux | |
bash $GITHUB_WORKSPACE/githubScripts/get-deno.sh $DENO_ROOT_PATH/linux Linux ${{ github.event.inputs.denoVersion }} | |
env: | |
DENO_ROOT_PATH: ${{ runner.temp }}/deno | |
- name: Check sources | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/levain-check.sh $DENO_ROOT_PATH/linux/deno | |
env: | |
DENO_ROOT_PATH: ${{ runner.temp }}/deno | |
- name: Git config commit user | |
run: | | |
# Git config commit user | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git config pull.rebase true | |
- name: Tag | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/tag-release.sh $LEVAIN_VERSION $NEXT_VERSION | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
NEXT_VERSION: ${{ env.NEXT_VERSION }} | |
- name: Changelog | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/changelog.sh latest $LEVAIN_VERSION $DENO_ROOT_PATH/linux > ${{ runner.temp }}/changelog.$LEVAIN_VERSION.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
DENO_ROOT_PATH: ${{ runner.temp }}/deno | |
- name: Levain release with tag | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/get-levain-tag.sh $LEVAIN_VERSION $LEVAIN_RELEASE_PATH | |
env: | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
LEVAIN_RELEASE_PATH: ${{ runner.temp }}/levain-${{ env.RELEASE_VERSION }} | |
- name: Levain embedded binaries | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/levain-embedded-binaries.sh $LEVAIN_RELEASE_PATH $DENO_ROOT_PATH/windows | |
env: | |
DENO_ROOT_PATH: ${{ runner.temp }}/deno | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
LEVAIN_RELEASE_PATH: ${{ runner.temp }}/levain-${{ env.RELEASE_VERSION }} | |
- name: Levain install - PowerShell | |
run: | | |
cp $LEVAIN_RELEASE_PATH/install/install.ps1 ${{ runner.temp }}/install.ps1 | |
env: | |
LEVAIN_RELEASE_PATH: ${{ runner.temp }}/levain-${{ env.RELEASE_VERSION }} | |
- name: Levain bootstrap | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/levain-bootstrap.sh $LEVAIN_RELEASE_PATH ${{ runner.temp }}/levainBootstrap-windows-x86_64.zip | |
env: | |
DENO_ROOT_PATH: ${{ runner.temp }}/deno | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
LEVAIN_RELEASE_PATH: ${{ runner.temp }}/levain-${{ env.RELEASE_VERSION }} | |
- name: Clean Levain release | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/clean-levain-release.sh $LEVAIN_RELEASE_PATH | |
env: | |
LEVAIN_RELEASE_PATH: ${{ runner.temp }}/levain-${{ env.RELEASE_VERSION }} | |
- name: Levain bundle | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/levain-bundle.sh $LEVAIN_RELEASE_PATH $DENO_ROOT_PATH/linux/deno | |
env: | |
DENO_ROOT_PATH: ${{ runner.temp }}/deno | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
LEVAIN_RELEASE_PATH: ${{ runner.temp }}/levain-${{ env.RELEASE_VERSION }} | |
- name: Levain package | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/levain-package.sh $LEVAIN_RELEASE_PATH ${{ runner.temp }}/levain-windows-x86_64.zip STRIP | |
env: | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
LEVAIN_RELEASE_PATH: ${{ runner.temp }}/levain-${{ env.RELEASE_VERSION }} | |
- name: Levain package - with version | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/levain-package.sh $LEVAIN_RELEASE_PATH ${{ runner.temp }}/levain-v$LEVAIN_VERSION-windows-x86_64.zip | |
env: | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
LEVAIN_RELEASE_PATH: ${{ runner.temp }}/levain-${{ env.RELEASE_VERSION }} | |
- name: Levain package binaries | |
run: | | |
bash $GITHUB_WORKSPACE/githubScripts/levain-package-binaries.sh $LEVAIN_RELEASE_PATH ${{ runner.temp }}/levain-extra-bin-windows-x86_64.zip | |
env: | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
LEVAIN_RELEASE_PATH: ${{ runner.temp }}/levain-${{ env.RELEASE_VERSION }} | |
############################################################## | |
### Create release | |
############################################################## | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v${{ env.RELEASE_VERSION }} | |
release_name: v${{ env.RELEASE_VERSION }} | |
commitish: master | |
body_path: ${{ runner.temp }}/changelog.${{ env.RELEASE_VERSION }}.md | |
draft: true | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
- name: Upload asset - levain-v${{ env.RELEASE_VERSION }}-windows-x86_64.zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ runner.temp }}/levain-v${{ env.RELEASE_VERSION }}-windows-x86_64.zip | |
asset_name: levain-v${{ env.RELEASE_VERSION }}-windows-x86_64.zip | |
asset_content_type: application/zip | |
- name: Upload asset - levain-v${{ env.RELEASE_VERSION }}-windows-x86_64.zip.sha256 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ runner.temp }}/levain-v${{ env.RELEASE_VERSION }}-windows-x86_64.zip.sha256 | |
asset_name: levain-v${{ env.RELEASE_VERSION }}-windows-x86_64.zip.sha256 | |
asset_content_type: text/plain | |
- name: Upload asset - levain-windows-x86_64.zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ runner.temp }}/levain-windows-x86_64.zip | |
asset_name: levain-windows-x86_64.zip | |
asset_content_type: application/zip | |
- name: Upload asset - levain-windows-x86_64.zip.sha256 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ runner.temp }}/levain-windows-x86_64.zip.sha256 | |
asset_name: levain-windows-x86_64.zip.sha256 | |
asset_content_type: text/plain | |
- name: Upload asset - levain-extra-bin-windows-x86_64.zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ runner.temp }}/levain-extra-bin-windows-x86_64.zip | |
asset_name: levain-extra-bin-windows-x86_64.zip | |
asset_content_type: application/zip | |
- name: Upload asset - levain-extra-bin-windows-x86_64.zip.sha256 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ runner.temp }}/levain-extra-bin-windows-x86_64.zip.sha256 | |
asset_name: levain-extra-bin-windows-x86_64.zip.sha256 | |
asset_content_type: text/plain | |
- name: Upload asset - levainBootstrap-windows-x86_64.zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ runner.temp }}/levainBootstrap-windows-x86_64.zip | |
asset_name: levainBootstrap-windows-x86_64.zip | |
asset_content_type: application/zip | |
- name: Upload asset - levainBootstrap-windows-x86_64.zip.sha256 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ runner.temp }}/levainBootstrap-windows-x86_64.zip.sha256 | |
asset_name: levainBootstrap-windows-x86_64.zip.sha256 | |
asset_content_type: text/plain | |
- name: Upload asset - install.ps1 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LEVAIN_VERSION: ${{ env.RELEASE_VERSION }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ runner.temp }}/install.ps1 | |
asset_name: install.ps1 | |
asset_content_type: text/plain | |
############################################################## | |
### Publish release | |
############################################################## | |
- name: Publish release | |
uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} |