Improve pipeline #12
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: Release Bosh Release | |
on: | |
workflow_dispatch: { } | |
push: | |
branches: | |
- "main" | |
env: | |
RELEASE: "otelcollector-binary" | |
BOSH_CLI_VERSION: "7.5.5" | |
permissions: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Git config and checkout LFS blobs | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
# git lfs install | |
# git lfs update --manual | |
# git lfs checkout | |
- name: Install Bosh cli | |
run: | | |
wget https://github.com/cloudfoundry/bosh-cli/releases/download/v${BOSH_CLI_VERSION}/bosh-cli-${BOSH_CLI_VERSION}-linux-amd64 -O bosh | |
chmod a+x bosh | |
- name: Create final bosh release | |
id: boshrelease | |
run: | | |
bosh sync-blobs | |
bosh create-release --final --tarball="release.tgz" | |
version=$(ls releases/$RELEASE/$RELEASE-*.yml | sed 's/.*\/.*-\(.*\)\.yml$/\1/' | sort -t. -k 1,1nr -k 2,2nr | head -1) | |
echo "version=${version}" >> $GITHUB_OUTPUT | |
- name: Uploads artifact release | |
uses: actions/upload-artifact@v4 | |
with: | |
name: boshelease | |
path: "release.tgz" | |
- name: Generate release notes from git commits | |
run: | | |
lastcommit=$(git log --no-walk --tags --pretty="%h %s" | awk 'NR==1{ print $1 }') | |
git_changes=$(git log --pretty="%h %aI %s (%an)" $lastcommit..@ | sed 's/^/- /') | |
version="${{ steps.boshrelease.outputs.version }}" | |
sha1=$(sha1sum -b "${{ steps.boshrelease.outputs.file }}" | cut -d' ' -f1) | |
cat <<EOF | tee > CHANGELOG.txt | |
# $RELEASE version $version | |
$DESCRIPTION | |
## Changes since last version | |
$git_changes | |
## Using in a bosh Deployment | |
releases: | |
- name: $RELEASE | |
url: https://github.com/${GITHUB_REPOSITORY}/releases/download/v${version}/${RELEASE}.tgz | |
version: $version | |
sha1: $sha1 | |
or to always point to latest release: | |
releases: | |
- name: $RELEASE | |
url: https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/${RELEASE}.tgz | |
version: latest | |
EOF | |
# - name: Create a Release | |
# uses: softprops/action-gh-release@v2 | |
# # if: startsWith(github.ref, 'refs/tags/') | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# tag_name: "v${{ steps.boshrelease.outputs.version }}" | |
# files: ${{ steps.boshrelease.outputs.file }} | |
# body_path: "${{ github.workspace }}-CHANGELOG.txt" | |
# generate_release_notes: true | |
# make_latest: true |