Release #104
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
name: Release | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
env: | |
ContainerRegistry: "ghcr.io" | |
ContainerRegistryRepo: "ghcr.io/eclipse-symphony" | |
BOT_USER_NAME: eclipse-symphoy-bot | |
BOT_EMAIL_ID: symphony-bot@eclipse.org | |
IMAGE_NAME: ${{ github.repository }} | |
# Two users are used in this pipeline | |
# BOT_USER_NAME (eclipse-symphoy-bot) / secrets.BOT_GITHUB_TOKEN is used to checkout/commit/push the changes to the repository | |
# github.repository_owner / secrets.GITHUB_TOKEN is used to login to the docker registry and helm registry and to create the release | |
jobs: | |
build: | |
if: github.repository == 'eclipse-symphony/symphony' && github.event_name != 'pull_request' && (github.actor == 'chgennar' || github.actor == 'juancooldude' || github.actor == 'Haishi2016' || github.actor == 'nonsocode' || github.actor == 'msftcoderdjw' || github.actor == 'TonyXiaofeng' || github.actor == 'iwangjintian') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.BOT_GITHUB_TOKEN }} | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Print branch name | |
run: echo ${{ steps.extract_branch.outputs.branch }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install -y make gcc | |
sudo snap install yq | |
- name: Install Helm | |
run: | | |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | |
chmod 700 get_helm.sh | |
./get_helm.sh | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.ContainerRegistry }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Helm Registry | |
run: helm registry login ${{ env.ContainerRegistry }} -u ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.4 # Replace with your desired Go version | |
- name: Install Kubebuilder | |
run: | | |
curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/$(go env GOOS)/$(go env GOARCH) | |
chmod +x kubebuilder | |
sudo mv kubebuilder /usr/local/bin/ | |
- name: Install Mage | |
run: | | |
cd .. | |
git clone https://github.com/magefile/mage | |
cd mage | |
go run bootstrap.go | |
cd .. | |
- name: Increment Version | |
id: increment_version | |
run: | | |
version=$(cat .github/version/versions.txt) | |
IFS='.' read -ra VERSION_PARTS <<< "$version" | |
VERSION_PARTS[2]=$((VERSION_PARTS[2] + 1)) | |
new_version="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}" | |
echo $new_version > .github/version/versions.txt | |
echo "version=$new_version" >> $GITHUB_OUTPUT | |
- name: Build Symphony Api | |
run: | | |
cd api | |
mage dockerBuildAPIMultiPlatform | |
mage dockerBuildTargetAgentMultiPlatform | |
mage dockerBuildPollAgentMultiPlatform | |
- name: Build Symphony k8s | |
run: | | |
cd k8s | |
mage dockerBuildK8sMultiPlatform | |
- name: Replace version in cli/cmd/up.go | |
run: | | |
version=$(cat .github/version/versions.txt) | |
sed -i "s/const SymphonyAPIVersion = .*/const SymphonyAPIVersion = \"$version\"/" cli/cmd/up.go | |
- name: Build maestro | |
run: | | |
cd cli | |
mage generatePackages /home/runner/maestro | |
cd .. | |
- name: Replace version in packages/helm/values.yaml | |
run: | | |
version=$(cat .github/version/versions.txt) | |
yq eval -i ".version = \"$version\"" packages/helm/symphony/Chart.yaml | |
yq eval -i ".appVersion = \"$version\"" packages/helm/symphony/Chart.yaml | |
yq eval -i ".version = \"$version\"" packages/helm/symphony-poll-agent/Chart.yaml | |
yq eval -i ".appVersion = \"$version\"" packages/helm/symphony-poll-agent/Chart.yaml | |
sed -i "s/{VERSION}/${{ steps.increment_version.outputs.version }}/g" packages/helm/symphony/values.yaml | |
sed -i "s/{VERSION}/${{ steps.increment_version.outputs.version }}/g" packages/helm/symphony-poll-agent/values.yaml | |
- name: Build Helm | |
run: | | |
cd k8s | |
mage helmTemplate | |
cd ../packages/helm | |
helm package symphony | |
helm package symphony-poll-agent | |
- name: Push symphony api images | |
run: | | |
docker buildx imagetools create -t ${{ env.ContainerRegistryRepo }}/symphony-api:latest ${{ env.ContainerRegistryRepo }}/symphony-api-multi:latest | |
docker buildx imagetools create -t ${{ env.ContainerRegistryRepo }}/symphony-api:${{ steps.increment_version.outputs.version }} ${{ env.ContainerRegistryRepo }}/symphony-api-multi:latest | |
docker buildx imagetools create -t ${{ env.ContainerRegistryRepo }}/symphony-target-agent:latest ${{ env.ContainerRegistryRepo }}/symphony-target-agent-multi:latest | |
docker buildx imagetools create -t ${{ env.ContainerRegistryRepo }}/symphony-target-agent:${{ steps.increment_version.outputs.version }} ${{ env.ContainerRegistryRepo }}/symphony-target-agent-multi:latest | |
docker buildx imagetools create -t ${{ env.ContainerRegistryRepo }}/symphony-poll-agent:latest ${{ env.ContainerRegistryRepo }}/symphony-poll-agent-multi:latest | |
docker buildx imagetools create -t ${{ env.ContainerRegistryRepo }}/symphony-poll-agent:${{ steps.increment_version.outputs.version }} ${{ env.ContainerRegistryRepo }}/symphony-poll-agent-multi:latest | |
- name: Push symphony k8s images | |
run: | | |
docker buildx imagetools create -t ${{ env.ContainerRegistryRepo }}/symphony-k8s:latest ${{ env.ContainerRegistryRepo }}/symphony-k8s-multi:latest | |
docker buildx imagetools create -t ${{ env.ContainerRegistryRepo }}/symphony-k8s:${{ steps.increment_version.outputs.version }} ${{ env.ContainerRegistryRepo }}/symphony-k8s-multi:latest | |
- name: Push symphony helm package | |
run: | | |
cd packages/helm | |
helm push symphony-${{ steps.increment_version.outputs.version }}.tgz oci://${{ env.ContainerRegistryRepo }}/helm | |
helm push symphony-poll-agent-${{ steps.increment_version.outputs.version }}.tgz oci://${{ env.ContainerRegistryRepo }}/helm | |
- name: Commit changes | |
run: | | |
git config --local user.name ${{ env.BOT_USER_NAME }} | |
git config --local user.email ${{ env.BOT_EMAIL_ID }} | |
git add .github/version/versions.txt | |
git add packages/helm/symphony/Chart.yaml | |
git add cli/cmd/up.go | |
git commit -m "Bump version to ${{ steps.increment_version.outputs.version }}" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.BOT_GITHUB_TOKEN }} | |
branch: ${{ steps.extract_branch.outputs.branch }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.increment_version.outputs.version }} | |
release_name: Release ${{ steps.increment_version.outputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload windows mastro packages | |
id: upload_mastro_windows_package | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /home/runner/maestro/maestro_windows_amd64.zip | |
asset_name: maestro_windows_amd64.zip | |
asset_content_type: application/gzip | |
- name: Upload linux mastro packages | |
id: upload_mastro_linux_package | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /home/runner/maestro/maestro_linux_amd64.tar.gz | |
asset_name: maestro_linux_amd64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload linux mastro ARM64 packages | |
id: upload_mastro_linux_arm64_package | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /home/runner/maestro/maestro_linux_arm64.tar.gz | |
asset_name: maestro_linux_arm64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload linux mastro ARM7 packages | |
id: upload_mastro_linux_arm_package | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /home/runner/maestro/maestro_linux_arm.tar.gz | |
asset_name: maestro_linux_arm.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload mac mastro packages | |
id: upload_mastro_mac_package | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /home/runner/maestro/maestro_darwin_amd64.tar.gz | |
asset_name: maestro_darwin_amd64.tar.gz | |
asset_content_type: application/gzip |