mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-16 05:16:08 +02:00
Check prerelease functionality (#5000)
* check release functionality * rename * rename and config fix (temporary) * permissions * change event type * fix * fix * temporary disable steps * add event type * fix * fix * fix * fix * fix * fix * uncomment * fix for PR * Apply suggestions from code review * Update release-go.yml --------- Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
This commit is contained in:
parent
5fb7142d19
commit
97e28683f5
64
.github/workflows/release-go.yml
vendored
64
.github/workflows/release-go.yml
vendored
@ -1,24 +1,21 @@
|
||||
name: Create new Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
repository_dispatch:
|
||||
types: perform-release
|
||||
schedule:
|
||||
- cron: '0 9 * * 1'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions: write-all
|
||||
name: Publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: styfle/cancel-workflow-action@0.11.0
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
# Workaround for https://github.com/SAP/jenkins-library/issues/1723, build only works with jdk8 currently
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 8
|
||||
distribution: zulu
|
||||
- name: Prepare Release
|
||||
|
||||
- name: Prepare assets and increment version
|
||||
run: |
|
||||
curl --insecure --silent --location --write-out '%{http_code}' --output ./piper_master https://github.com/SAP/jenkins-library/releases/latest/download/piper_master
|
||||
curl --insecure --silent --location --write-out '%{http_code}' --output ./piper_master-darwin.x86_64 https://github.com/SAP/jenkins-library/releases/latest/download/piper_master-darwin.x86_64
|
||||
@ -28,12 +25,59 @@ jobs:
|
||||
cp ./piper_master-darwin.arm64 ./piper-darwin.arm64
|
||||
npm install semver --quiet
|
||||
echo "PIPER_version=v$(node_modules/.bin/semver -i minor $(curl --silent "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest" | jq -r .tag_name))" >> $GITHUB_ENV
|
||||
|
||||
- uses: SAP/project-piper-action@master
|
||||
name: 'publish Linux master binary'
|
||||
name: Publish prerelease
|
||||
with:
|
||||
piper-version: master
|
||||
command: githubPublishRelease
|
||||
flags: --token ${{ secrets.GITHUB_TOKEN }} --assetPathList ./piper_master --assetPathList ./piper --assetPathList ./piper_master-darwin.x86_64 --assetPathList ./piper-darwin.x86_64 --assetPathList ./piper_master-darwin.arm64 --assetPathList ./piper-darwin.arm64
|
||||
flags: >
|
||||
--preRelease true
|
||||
--token ${{ secrets.GITHUB_TOKEN }}
|
||||
--assetPathList ./piper --assetPathList ./piper_master
|
||||
--assetPathList ./piper-darwin.x86_64 --assetPathList ./piper_master-darwin.x86_64
|
||||
--assetPathList ./piper-darwin.arm64 --assetPathList ./piper_master-darwin.arm64
|
||||
|
||||
- name: Download Piper binary from recently published prerelease
|
||||
uses: robinraju/release-downloader@v1
|
||||
with:
|
||||
tag: ${{ env.PIPER_version }}
|
||||
fileName: 'piper'
|
||||
|
||||
- name: Test binary (check output for 'commit:' substring)
|
||||
run: |
|
||||
chmod +x piper
|
||||
if ./piper version | grep -Fq "commit:"; then
|
||||
echo "piper binary test is successful"
|
||||
else
|
||||
echo "piper binary test failed"
|
||||
./piper version
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Get recently published prerelease id
|
||||
id: release_id
|
||||
run: >
|
||||
curl -L -s -o resp.json
|
||||
-H "Accept: application/vnd.github.raw+json"
|
||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"
|
||||
${{ github.api_url }}/repos/${{ github.repository }}/releases
|
||||
|
||||
echo "release_id=$(jq 'first(.[] | select(.tag_name == "${{ env.PIPER_version }}")).id' resp.json)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Convert prereleae to Release
|
||||
run: >
|
||||
curl --fail-with-body -L -X PATCH
|
||||
-H "Accept: application/vnd.github+json"
|
||||
-H "Authorization: Bearer ${{ github.token }}"
|
||||
${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ steps.release_id.outputs.release_id }}
|
||||
-d '{"prerelease": false, "make_latest": true}'
|
||||
|
||||
# Workaround for https://github.com/SAP/jenkins-library/issues/1723, build only works with jdk8 currently
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 8
|
||||
distribution: zulu
|
||||
- name: Build and publish jar for consumption in unit tests
|
||||
run: mvn package
|
||||
- uses: SAP/project-piper-action@master
|
||||
|
Loading…
Reference in New Issue
Block a user