diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index eb8c1e2..52e11b4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -65,21 +65,23 @@ jobs: gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/${version}.tgz gs://helm.coder.com/logstream-kube gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/index.yaml gs://helm.coder.com/logstream-kube - - name: Create Release - uses: actions/create-release@v1 - id: create_release - env: - GITHUB_TOKEN: ${{ github.token }} - with: - release_name: ${{ steps.version.outputs.version }} - tag_name: ${{ github.ref }} + - name: Create and upload release + run: | + set -euo pipefail + version=${{ steps.version.outputs.version }} + + # check if release already exists and match the version + if [[ $(gh release view $version --json name -q '.name' | cat) == $version ]]; then + echo "Release $version already exists" + exit 0 + fi - - name: Upload Helm Release Asset - uses: actions/upload-release-asset@v1 + echo "Creating release $version" + # if version contains -rc, publish as a pre-release and don't set as latest + if [[ $version == *-rc* ]]; then + gh release create $version -t $version --generate-notes --prerelease --latest=false --verify-tag build/${version}.tgz#helm.tar.gz + else + gh release create $version -t $version --generate-notes --verify-tag build/${version}.tgz#helm.tar.gz + fi env: GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: build/${{ steps.version.outputs.version }}.tgz - asset_name: helm.tar.gz - asset_content_type: application/gzip diff --git a/scripts/build.sh b/scripts/build.sh index 7f8b1a5..a17eb0b 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -33,12 +33,17 @@ fi # Ensure the builder is bootstrapped and ready to use docker buildx inspect --bootstrap &>/dev/null -# Build +# Build and push the image if [ "$CI" = "false" ]; then docker buildx build --platform linux/"$current" -t coder-logstream-kube --load . else VERSION=$(../scripts/version.sh) BASE=ghcr.io/coder/coder-logstream-kube IMAGE=$BASE:$VERSION - docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t "$IMAGE" -t $BASE:latest --push . + # if version contains "rc" skip pushing to latest + if [[ $VERSION == *"rc"* ]]; then + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t "$IMAGE" --push . + else + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t "$IMAGE" -t $BASE:latest --push . + fi fi
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: