Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release workflow improvements [main] #2878

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/release/release-notes-template copy.txt
gururajsh marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Package Manager Installation
----------
- [apt-get, yum, homebrew](https://github.com/cloudfoundry/cli#getting-started)

Installers
----------
- Debian [64 bit](https://packages.cloudfoundry.org/stable?release=debian64&version=new-version&source=github-rel) / [32 bit](https://packages.cloudfoundry.org/stable?release=debian32&version=new-version&source=github-rel) / [arm64](https://packages.cloudfoundry.org/stable?release=debianarm64&version=new-version&source=github-rel) (deb)
- Redhat [64 bit](https://packages.cloudfoundry.org/stable?release=redhat64&version=new-version&source=github-rel) / [32 bit](https://packages.cloudfoundry.org/stable?release=redhat32&version=new-version&source=github-rel) / [aarch64](https://packages.cloudfoundry.org/stable?release=redhataarch64&version=new-version&source=github-rel) (rpm)
- macOS [64 bit](https://packages.cloudfoundry.org/stable?release=macosx64&version=new-version&source=github-rel) / [arm](https://packages.cloudfoundry.org/stable?release=macosarm&version=new-version&source=github-rel) (pkg)
- Windows [64 bit](https://packages.cloudfoundry.org/stable?release=windows64&version=new-version&source=github-rel) / [32 bit](https://packages.cloudfoundry.org/stable?release=windows32&version=new-version&source=github-rel) (zip)

Binaries
--------
- Linux [64 bit](https://packages.cloudfoundry.org/stable?release=linux64-binary&version=new-version&source=github-rel) / [32 bit](https://packages.cloudfoundry.org/stable?release=linux32-binary&version=new-version&source=github-rel) / [arm64](https://packages.cloudfoundry.org/stable?release=linuxarm64-binary&version=new-version&source=github-rel) (tgz)
- macOS [64 bit](https://packages.cloudfoundry.org/stable?release=macosx64-binary&version=new-version&source=github-rel) / [arm](https://packages.cloudfoundry.org/stable?release=macosarm-binary&version=new-version&source=github-rel) (tgz)
- Windows [64 bit](https://packages.cloudfoundry.org/stable?release=windows64-exe&version=new-version&source=github-rel) / [32 bit](https://packages.cloudfoundry.org/stable?release=windows32-exe&version=new-version&source=github-rel) (zip)


Docker
--------
```shell
docker pull cloudfoundry/cli:new-version
```
136 changes: 91 additions & 45 deletions .github/workflows/release-build-sign-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ jobs:
name: Setup
# needs: test
runs-on: ubuntu-latest
if: ${{ github.action_repository != 'cloudfoundry/cli' }}

a-b marked this conversation as resolved.
Show resolved Hide resolved
outputs:
secrets-environment: ${{ steps.set-secrets-environment.outputs.secrets-environment }}
aws-s3-bucket: "v${{ steps.parse-semver.outputs.version-major }}-cf-cli-releases"

version-build: ${{ steps.parse-semver.outputs.version-build }}
Expand All @@ -92,9 +90,6 @@ jobs:
version-patch: ${{ steps.parse-semver.outputs.version-patch }}

steps:
- id: set-secrets-environment
run: echo "secrets-environment=PROD" >> "${GITHUB_OUTPUT}"

- name: Checkout cli
uses: actions/checkout@v4

Expand Down Expand Up @@ -124,7 +119,6 @@ jobs:
needs:
- setup
runs-on: ubuntu-20.04
environment: ${{ needs.setup.outputs.secrets-environment }}

env:
VERSION_BUILD: ${{ needs.setup.outputs.version-build }}
Expand Down Expand Up @@ -398,7 +392,6 @@ jobs:
VERSION_BUILD: ${{ needs.setup.outputs.version-build }}
VERSION_MAJOR: ${{ needs.setup.outputs.version-major }}
runs-on: macos-latest
environment: ${{ needs.setup.outputs.secrets-environment }}
steps:

- name: Get Build Version
Expand Down Expand Up @@ -625,7 +618,6 @@ jobs:
needs:
- setup
runs-on: windows-2019
environment: ${{ needs.setup.outputs.secrets-environment }}
defaults:
run:
shell: pwsh
Expand Down Expand Up @@ -785,7 +777,6 @@ jobs:
- test-deb-package
- test-macos
- test-windows
environment: ${{ needs.setup.outputs.secrets-environment }}
permissions:
actions: read
contents: read
Expand Down Expand Up @@ -887,6 +878,13 @@ jobs:
signed/win32/*zip \
signed/winx64/*zip

- name: Store Artifacts
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: final-artifacts
path: signed/*

- name: Setup aws to upload installers to CLAW S3 bucket
uses: aws-actions/configure-aws-credentials@v4
env:
Expand All @@ -907,41 +905,6 @@ jobs:
- name: list S3 for human verification
run: aws s3 ls "s3://v${VERSION_MAJOR}-cf-cli-releases/releases/v${VERSION_BUILD}/"

- name: Instruct human to update CLAW
run: |
echo "Please go to https://github.com/cloudfoundry/CLAW/blob/develop/claw-variables.yml and add the following line to the file:"
echo
echo "- ${VERSION_BUILD}"

github-release-draft:
name: Create GitHub Release Draft
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
needs:
- setup
- test-rpm-package
- test-deb-package
- test-macos
- test-windows
environment: ${{ needs.setup.outputs.secrets-environment }}
steps:
- name: Download signed artifacts
uses: actions/download-artifact@v4
with:
path: signed # download all artifacts to 'signed/'

- name: Create draft release
uses: pivotalsoftware/action-gh-release@v1
with:
draft: true
name: "DRAFT v${{ env.VERSION_BUILD }}"
# tag_name: "v${{ env.VERSION_BUILD }}"
repository: ${{ secrets.GIT_RELEASE_TARGET_REPO }} # repo to draft a release under, in <user>/<repo> format
token: ${{ secrets.GIT_REPO_ACCESS_TOKEN }} # only needed when pushing to a repo other than 'self'
fail_on_unmatched_files: true

test-rpm-package:
name: Test RPM Artifacts
needs:
Expand Down Expand Up @@ -969,7 +932,6 @@ jobs:
needs:
- setup
- build-linux
environment: ${{ needs.setup.outputs.secrets-environment }}
runs-on: ubuntu-20.04
container:
image: ubuntu:20.04
Expand Down Expand Up @@ -1044,4 +1006,88 @@ jobs:
Get-AuthenticodeSignature -Verbose -ErrorAction Stop ".\winx64\cf${env:VERSION_MAJOR}_installer.exe"
Get-AuthenticodeSignature -Verbose -ErrorAction Stop ".\win32\cf${env:VERSION_MAJOR}_installer.exe"

github-release-draft:
name: Create GitHub Release Draft
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
needs:
- setup
- test-rpm-package
- test-deb-package
- test-macos
- test-windows
steps:
- name: Download signed artifacts
uses: actions/download-artifact@v4
with:
name: final-artifacts
path: artifacts # download all artifacts to 'artifacts/'

- name: Checkout CLI
uses: actions/checkout@v4

- name: Prepare release notes
run: |
sed -i 's/new-version/${{ needs.setup.outputs.version-build }}/g' .github/release/release-notes-template.txt

- name: Create draft release
uses: softprops/action-gh-release@v2
with:
draft: true
name: "DRAFT v${{ needs.setup.outputs.version-build }}"
tag_name: "v${{ needs.setup.outputs.version-build }}"
body_path: ".github/release/release-notes-template.txt"
fail_on_unmatched_files: true
generate_release_notes: true
files: |
artifacts/cf-cli-linux-rpm-packages/cf*rpm
artifacts/cf-cli-linux-deb-packages/cf*deb
artifacts/cf-cli-macos-packages/cf*pkg
artifacts/cf-cli-windows-packages/cf*zip
artifacts/linux_i686/*tgz
artifacts/linux_x86-64/*tgz
artifacts/linux_arm64/*tgz
artifacts/osx/*tgz
artifacts/macosarm/*tgz
artifacts/win32/*zip
artifacts/winx64/*zip

update-claw:
name: Add new release version to CLAW
runs-on: ubuntu-latest
needs:
- setup
- s3-upload
env:
VERSION_BUILD: ${{ needs.setup.outputs.version-build }}
steps:
- name: Checkout CLAW
uses: actions/checkout@v4
with:
repository: cloudfoundry/CLAW
ref: develop
path: CLAW
ssh-key: ${{ secrets.GIT_SSH_KEY_CLAW }}

- name: Add new version to claw variables
run: |
set -ex

pushd CLAW
echo "- ${VERSION_BUILD}" >> claw-variables.yml

git add claw-variables.yml

if ! [ -z "$(git status --porcelain)"]; then
git config user.name github-actions
git config user.email github-actions@github.com
git commit -m "Add CF CLI ${VERSION_BUILD}"
else
echo "no new version to commit"
fi

git push
popd
# vim: set sw=2 ts=2 sts=2 et tw=78 foldlevel=2 fdm=indent nospell:
Loading