Publish Release for Workflow: 12305274864 #8
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: "Publish release" | |
run-name: > | |
${{ format('Publish Release for Workflow: {0}', inputs.workflow_id) }} | |
on: | |
workflow_dispatch: | |
inputs: | |
workflow_id: | |
description: | | |
Workflow Run ID from this repository to fetch artifacts from for this | |
release. | |
required: true | |
type: string | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
get-version: | |
name: Get application version info for this revision | |
runs-on: ubuntu-latest | |
outputs: | |
git-sha: ${{ steps.get-version.outputs.git-sha }} | |
otc-version: ${{ steps.set-versions.outputs.otc_version }} | |
otc-build-number: ${{ steps.set-versions.outputs.otc_build_number }} | |
otc-sumo-version: ${{ steps.set-versions.outputs.otc_sumo_version }} | |
package-version: ${{ steps.set-versions.outputs.package_version }} | |
binary-version: ${{ steps.set-versions.outputs.binary_version }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Outuput Workflow ID | |
run: echo ::notice title=Workflow ID::${{ inputs.workflow_id }} | |
- name: Output Workflow URL | |
run: | | |
repo_url="https://github.com/SumoLogic/sumologic-otel-collector-packaging" | |
url="${repo_url}/actions/runs/${{ inputs.workflow_id }}" | |
echo ::notice title=Workflow URL::${url} | |
- name: Download version artifacts from workflow | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "*.txt" | |
path: artifacts/ | |
merge-multiple: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
run-id: ${{ inputs.workflow_id }} | |
- name: Set version outputs | |
id: set-versions | |
run: | | |
otc_version="$(cat artifacts/otc-version.txt)" | |
otc_build_number="$(cat artifacts/otc-build-number.txt)" | |
otc_sumo_version="$(cat artifacts/otc-sumo-version.txt)" | |
echo otc_version="${otc_version}" >> $GITHUB_OUTPUT | |
echo otc_build_number="${otc_build_number}" >> $GITHUB_OUTPUT | |
echo otc_sumo_version="${otc_sumo_version}" >> $GITHUB_OUTPUT | |
echo package_version="${otc_version}-${otc_build_number}" >> $GITHUB_OUTPUT | |
echo binary_version="${otc_version}-sumo-${otc_sumo_version}" >> $GITHUB_OUTPUT | |
- name: Output OTC Version | |
run: | | |
version="${{ steps.set-versions.outputs.otc_version }}" | |
echo ::notice title=OTC Version::${version} | |
- name: Output OTC Build Number | |
run: | | |
version="${{ steps.set-versions.outputs.otc_build_number }}" | |
echo ::notice title=OTC Build Number::${version} | |
- name: Output OTC Sumo Version | |
run: | | |
version=${{ steps.set-version.outputs.otc_sumo_version }} | |
echo ::notice title=OTC Sumo Version::${version} | |
- name: Determine Git SHA of workflow | |
id: get-sha | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
workflow=${{ inputs.workflow_id }} | |
sha="$(gh run view ${workflow} --json headSha -t '{{.headSha}}')" | |
echo "git-sha=$sha" >> $GITHUB_OUTPUT | |
- name: Output Git SHA | |
run: | | |
echo ::notice title=Git SHA::${{ steps.get-sha.outputs.git-sha }} | |
# Store the install script from the packaging repository as a release | |
# artifact. | |
install-script: | |
name: Store install script | |
runs-on: ubuntu-latest | |
needs: | |
- get-version | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.get-version.outputs.git-sha }} | |
- name: Store Linux install script as action artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: install.sh | |
path: ./install-script/install.sh | |
if-no-files-found: error | |
- name: Store Windows install script as action artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: install.ps1 | |
path: ./install-script/install.ps1 | |
if-no-files-found: error | |
create-release: | |
name: Create Github release | |
runs-on: ubuntu-20.04 | |
needs: | |
- get-version | |
permissions: | |
contents: write | |
steps: | |
- name: Download all artifacts from workflow | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
merge-multiple: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
run-id: ${{ inputs.workflow_id }} | |
- name: List all artifacts | |
run: ls -l artifacts/ | |
- uses: ncipollo/release-action@v1 | |
with: | |
name: v${{ needs.get-version.outputs.package-version }} | |
commit: ${{ needs.get-version.outputs.git-sha }} | |
tag: v${{ needs.get-version.outputs.package-version }} | |
draft: true | |
generateReleaseNotes: true | |
prerelease: false | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
omitNameDuringUpdate: true | |
artifacts: "artifacts/*" | |
artifactErrorsFailBuild: true | |
replacesArtifacts: false | |
body: | | |
This release packages Sumo Logic Distributions for OpenTelemetry Collector [${{ needs.get-version.outputs.binary-version }}](https://github.com/SumoLogic/sumologic-otel-collector/releases/tag/v${{ needs.get-version.outputs.binary-version }}). | |
The changelog below is for the package itself, rather than the Sumo Logic Distribution for OpenTelemetry Collector. The changelog for the Sumo Logic Distribution for OpenTelemetry Collector can be found on the collector's [release page](https://github.com/SumoLogic/sumologic-otel-collector/releases/tag/v${{ needs.get-version.outputs.binary-version }}). |