Skip to content

Prepare v2.20.3-rc.2 #237

Prepare v2.20.3-rc.2

Prepare v2.20.3-rc.2 #237

Workflow file for this run

name: Releases
on:
push:
tags:
# These aren't regexps. They are "Workflow Filter patterns"
- v[0-9]+.[0-9]+.[0-9]
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-test.[0-9]+
env:
TELEPRESENCE_REGISTRY: ghcr.io/telepresenceio
jobs:
build-release:
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-latest
- windows-latest
arch:
- amd64
- arm64
exclude:
- runner: windows-latest
arch: arm64
runs-on: ${{ matrix.runner }}
env:
GOARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/install-dependencies
name: install dependencies
- name: set version
shell: bash
run: echo "TELEPRESENCE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: generate binaries
run: make release-binary
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.runner }}-${{ matrix.arch }}
path: build-output/release
retention-days: 1
push-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/install-dependencies
name: install dependencies
- name: set version
shell: bash
run: |
v=${{ github.ref_name }}
echo "TELEPRESENCE_VERSION=$v" >> "$GITHUB_ENV"
echo "TELEPRESENCE_SEMVER=${v#v}" >> "$GITHUB_ENV"
- name: Setup docker buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Build image dependencies
run: make images-deps
- name: Make helm chart
run: make helm-chart
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push client image
run: |
docker buildx build --platform=linux/amd64,linux/arm64 --build-arg TELEPRESENCE_VERSION=${{env.TELEPRESENCE_SEMVER}} \
--push --tag ${{env.TELEPRESENCE_REGISTRY}}/telepresence:${{env.TELEPRESENCE_SEMVER}} -f build-aux/docker/images/Dockerfile.client .
- name: Push tel2 image
run: |
docker buildx build --platform=linux/amd64,linux/arm64 --build-arg TELEPRESENCE_VERSION=${{env.TELEPRESENCE_SEMVER}} \
--push --tag ${{env.TELEPRESENCE_REGISTRY}}/tel2:${{env.TELEPRESENCE_SEMVER}} -f build-aux/docker/images/Dockerfile.traffic .
- name: Push Helm Chart
run: helm push build-output/telepresence-chart.tgz oci://${{env.TELEPRESENCE_REGISTRY}}
- name: Log out from registry
if: always()
run: docker logout
publish-release:
runs-on: ubuntu-latest
needs:
- build-release
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Determine if version is RC, TEST, or GA
id: semver_check
run: |
if [[ "${{ github.ref_name }}" =~ ^v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+$ ]]; then
echo "make_latest=false" >> $GITHUB_OUTPUT
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" =~ ^v[0-9]+.[0-9]+.[0-9]+-test.[0-9]+$ ]]; then
echo "make_latest=false" >> $GITHUB_OUTPUT
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" =~ ^v[0-9]+.[0-9]+.[0-9]+-draft.[0-9]+$ ]]; then
echo "make_latest=false" >> $GITHUB_OUTPUT
echo "draft=true" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
else
echo "make_latest=true" >> $GITHUB_OUTPUT
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Create draft release
if: steps.semver_check.outputs.draft == true
uses: ncipollo/release-action@v1
with:
artifacts: "binaries-*/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft:
tag: ${{ github.ref_name }}
body: |
## Draft Release
For more information, visit our [installation docs](https://www.telepresence.io/docs/latest/quick-start/).
- name: Create release
if: steps.semver_check.outputs.draft != true
uses: ncipollo/release-action@v1
with:
artifacts: "binaries-*/*"
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ steps.semver_check.outputs.prerelease }}
makeLatest: ${{ steps.semver_check.outputs.make_latest }}
tag: ${{ github.ref_name }}
body: |
## Official Release Artifacts
### Linux
- 📦 [telepresence-linux-amd64](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-linux-amd64)
- 📦 [telepresence-linux-arm64](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-linux-arm64)
### OSX Darwin
- 📦 [telepresence-darwin-amd64](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-darwin-amd64)
- 📦 [telepresence-darwin-arm64](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-darwin-arm64)
### Windows
- 📦 [telepresence-windows-amd64.zip](https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}/telepresence-windows-amd64.zip)
For more builds across platforms and architectures, see the `Assets` section below.
And for more information, visit our [installation docs](https://www.telepresence.io/docs/quick-start/).
![Assets](https://static.scarf.sh/a.png?x-pxid=d842651a-2e4d-465a-98e1-4808722c01ab)
- uses: actions/checkout@v4
if: needs.publish-release.semver_check.outputs.make_latest
- name: Update Homebrew
if: needs.publish-release.semver_check.outputs.make_latest
run: |
v=${{ github.ref_name }}
packaging/homebrew-package.sh "${v#v}" tel2oss "${{ vars.GH_BOT_USER }}" "${{ vars.GH_BOT_EMAIL }}" "${{ secrets.HOMEBREW_TAP_TOKEN }}"
test-release:
needs:
- push-images
- publish-release
if: needs.publish-release.semver_check.outputs.draft != true
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-latest
- windows-latest
arch:
- amd64
- arm64
exclude:
- runner: windows-latest
arch: arm64
runs-on: ${{ matrix.runner }}
steps:
- name: download binary
env:
DOWNLOAD_URL: "https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}"
shell: bash
run: |
if [ "${{ runner.os }}" = "macOS" ]; then
curl -fL ${{ env.DOWNLOAD_URL }}/telepresence-darwin-${{ matrix.arch }} -o ./telepresence || { echo "Curl command failed" ; exit 1; }
elif [ "${{ runner.os }}" = "Windows" ]; then
curl -fL ${{ env.DOWNLOAD_URL }}/telepresence-windows-${{ matrix.arch }}.zip -o ./telepresence.zip || { echo "Curl command failed" ; exit 1; }
unzip ./telepresence.zip || { echo "Unzip command failed" ; exit 1; }
else
curl -fL ${{ env.DOWNLOAD_URL }}/telepresence-linux-${{ matrix.arch }} -o ./telepresence || { echo "Curl command failed" ; exit 1; }
fi
- name: test binary
shell: bash
if: ${{ !(runner.os == 'Linux' && runner.arch == 'X64' && matrix.arch == 'arm64') }}
run: |
chmod +x ./telepresence
output=$(./telepresence version)
if [ $? -eq 0 ]; then
echo "Telepresence command executed successfully"
else
echo "Telepresence command failed"
exit 1
fi
echo "$output" | grep -q "Client\s*:\s*${{ github.ref_name }}"
if [ $? -eq 0 ]; then
echo "Version match!"
else
echo "Version does not match!"
exit 1
fi