fix upload artifact name conflict #3561
Workflow file for this run
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
# ------------------------------------------------------------ | |
# Copyright 2021 The Dapr Authors | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# ------------------------------------------------------------ | |
name: dapr_cli | |
on: | |
push: | |
branches: | |
- master | |
- release-* | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
- release-* | |
jobs: | |
build: | |
name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} binaries | |
runs-on: ${{ matrix.os }} | |
env: | |
GOLANG_CI_LINT_VER: v1.55.2 | |
GOOS: ${{ matrix.target_os }} | |
GOARCH: ${{ matrix.target_arch }} | |
GOPROXY: https://proxy.golang.org | |
ARCHIVE_OUTDIR: dist/archives | |
DaprEXEDirectory: dist/windows_amd64/release | |
DaprLicenseDirectory: .github/wix | |
WIX_BIN_PATH: 'C:/Program Files (x86)/WiX Toolset v3.11/bin' | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
target_arch: [arm, arm64, amd64] | |
include: | |
- os: ubuntu-latest | |
target_os: linux | |
- os: windows-latest | |
target_os: windows | |
- os: macOS-latest | |
target_os: darwin | |
exclude: | |
- os: windows-latest | |
target_arch: arm | |
- os: windows-latest | |
target_arch: arm64 | |
- os: macOS-latest | |
target_arch: arm | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
id: setup-go | |
with: | |
go-version-file: 'go.mod' | |
- name: Cache Go modules (Linux) | |
if: matrix.target_os == 'linux' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}- | |
- name: Cache Go modules (Windows) | |
if: matrix.target_os == 'windows' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~\AppData\Local\go-build | |
~\go\pkg\mod | |
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}- | |
- name: Cache Go modules (macOS) | |
if: matrix.target_os == 'darwin' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/Library/Caches/go-build | |
~/go/pkg/mod | |
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}- | |
- name: Run golangci-lint | |
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' | |
uses: golangci/[email protected] | |
with: | |
version: ${{ env.GOLANG_CI_LINT_VER }} | |
skip-cache: true | |
- name: Run make modtidy check-diff | |
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' | |
run: make modtidy check-diff | |
- name: Parse release version and set REL_VERSION | |
run: python ./.github/scripts/get_release_version.py | |
- name: Setup test output | |
shell: bash | |
run: | | |
export TEST_OUTPUT_FILE=$GITHUB_WORKSPACE/test-unit.json | |
echo "TEST_OUTPUT_FILE=$TEST_OUTPUT_FILE" >> $GITHUB_ENV | |
- name: Run make test | |
env: | |
COVERAGE_OPTS: "-coverprofile=coverage.txt -covermode=atomic" | |
if: matrix.target_arch == 'amd64' | |
run: make test | |
- name: Codecov | |
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' | |
uses: codecov/codecov-action@v3 | |
- name: Run make release to build and archive binaries | |
run: | | |
mkdir -p ${{ env.ARCHIVE_OUTDIR }} | |
make release GOOS=${{ matrix.target_os }} GOARCH=${{ matrix.target_arch }} ARCHIVE_OUT_DIR=${{ env.ARCHIVE_OUTDIR }} | |
- name: Build msi installer | |
if: matrix.target_arch == 'amd64' && matrix.target_os == 'windows' | |
shell: pwsh | |
run: | | |
$env:Path += ";${{ env.WIX_BIN_PATH }}" | |
candle.exe -dVersion="${{ env.MSI_VERSION }}" -dDaprEXEDirectory="${{ env.DaprEXEDirectory }}" -dDaprLicenseDirectory="${{ env.DaprLicenseDirectory }}" .github/wix/dapr.wxs -o dapr.wixobj | |
light.exe -ext WixUIExtension ./dapr.wixobj -o "${{ env.ARCHIVE_OUTDIR }}/dapr.msi" | |
- name: Create release_version.txt | |
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' | |
run: | | |
[ ! -z "${{ env.REL_VERSION }}" ] && echo "${{ env.REL_VERSION }}" > "${{ env.ARCHIVE_OUTDIR }}/release_version.txt" | |
- name: upload artifacts ## Following migration guide in https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cli_drop-${{ matrix.target_os }}_${{ matrix.target_arch }} | |
path: ${{ env.ARCHIVE_OUTDIR }} | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target_os }}_${{ matrix.target_arch }}_test_unit.json | |
path: ${{ env.TEST_OUTPUT_FILE }} | |
publish: | |
name: Publish binaries | |
needs: build | |
if: startswith(github.ref, 'refs/tags/v') | |
env: | |
ARTIFACT_DIR: ./release | |
runs-on: ubuntu-latest | |
steps: | |
- name: download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: cli_drop-* | |
merge-multiple: true | |
path: ${{ env.ARTIFACT_DIR }} | |
- name: Set Release Version | |
run: | | |
REL_VERSION_FILE="${{ env.ARTIFACT_DIR }}/release_version.txt" | |
REL_VER=`cat ${REL_VERSION_FILE}` | |
echo "REL_VERSION=${REL_VER}" >> $GITHUB_ENV | |
rm -f ${REL_VERSION_FILE} | |
- name: generate checksum files | |
run: cd ${ARTIFACT_DIR} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd - | |
- name: lists artifacts | |
run: ls -l ${{ env.ARTIFACT_DIR }} | |
- name: publish binaries to github | |
if: startswith(github.ref, 'refs/tags/v') | |
run: | | |
# Get the list of files | |
RELEASE_ARTIFACT=(${ARTIFACT_DIR}/*) | |
export GITHUB_TOKEN=${{ secrets.DAPR_BOT_TOKEN }} | |
echo "Uploading Dapr CLI Binaries to GitHub Release" | |
gh release create \ | |
"v${REL_VERSION}" \ | |
--title "Dapr CLI v${REL_VERSION}" \ | |
--repo $GITHUB_REPOSITORY \ | |
--prerelease \ | |
${RELEASE_ARTIFACT[*]} | |
publish-winget: | |
name: Publish to winget-pkgs | |
needs: publish | |
if: startswith(github.ref, 'refs/tags/v') | |
runs-on: windows-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Parse release version and set REL_VERSION | |
run: python ./.github/scripts/get_release_version.py | |
- name: Update winget manifests | |
shell: pwsh | |
run: | | |
$url = "https://github.com/dapr/cli/releases/download/v${{ env.REL_VERSION }}/dapr.msi" | |
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe | |
if("${{ env.REL_VERSION }}".Contains("-rc.")){ | |
$PackageIdentifier="Dapr.CLI.Preview" | |
} else{ | |
$PackageIdentifier="Dapr.CLI" | |
} | |
.\wingetcreate.exe update "$PackageIdentifier" --submit --urls "$url|x64" --version "${{ env.REL_VERSION }}" --token "${{ secrets.DAPR_BOT_TOKEN }}" |