Skip to content

Commit

Permalink
update/fix release logic in github actions (#373)
Browse files Browse the repository at this point in the history
Signed-off-by: David Grove <[email protected]>
  • Loading branch information
dgrove-oss authored May 3, 2023
1 parent 53086c5 commit 091a12c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,4 @@ jobs:
run: KAR_VERSION=$(git rev-parse --short "$GITHUB_SHA") DOCKER_REGISTRY=quay.io DOCKER_NAMESPACE=ibm DOCKER_IMAGE_TAG=latest make docker
- name: Push Release Images
if: ${{ env.PUSH_RELEASE == 'true' }}
run: KAR_VERSION=${GITHUB_REF_NAME} DOCKER_REGISTRY=quay.io DOCKER_NAMESPACE=ibm DOCKER_IMAGE_TAG=${GITHUB_REF_NAME} make docker
run: KAR_VERSION=${GITHUB_REF_NAME#v} DOCKER_REGISTRY=quay.io DOCKER_NAMESPACE=ibm DOCKER_IMAGE_TAG=${GITHUB_REF_NAME#v} make docker
61 changes: 16 additions & 45 deletions .github/workflows/cli-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,64 +22,35 @@ on:

name: Make CLI Release

permissions:
contents: write

jobs:
build:
name: Make CLI Release
runs-on: ubuntu-latest
if: github.repository == 'IBM/kar'
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: 'core/go.mod'
cache-dependency-path: 'core/go.sum'
- name: Get Version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v}
- name: Compute version
run: echo "KAR_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Build CLI
run: |
KAR_VERSION=${{ steps.get_version.outputs.VERSION }} ./ci/build-cli-release.sh
echo $KAR_VERSION
./ci/build-cli-release.sh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Upload MacOS amd64
id: upload-mac-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./core/build/kar-mac-amd64.zip
asset_name: kar-mac-amd64.zip
asset_content_type: application/zip
- name: Upload Windows amd64
id: upload-windows-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./core/build/kar-windows-amd64.zip
asset_name: kar-windows-amd64.zip
asset_content_type: application/zip
- name: Upload Linux amd64
id: upload-linux-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./core/build/kar-linux-amd64.tgz
asset_name: kar-linux-amd64.tgz
asset_content_type: application/gzip


name: ${{ env.KAR_VERSION }}
fail_on_unmatched_files: true
files: |
./core/build/kar-linux-amd64.tgz
./core/build/kar-mac-amd64.zip
./core/build/kar-mac-arm64.zip
./core/build/kar-windows-amd64.zip
1 change: 1 addition & 0 deletions ci/build-cli-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ buildOne() {
}

buildOne "darwin" "amd64"
buildOne "darwin" "arm64"
buildOne "linux" "amd64"
buildOne "windows" "amd64"

0 comments on commit 091a12c

Please sign in to comment.