Release #32
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: write-all | |
env: | |
ContainerRegistry: "ghcr.io" | |
ContainerRegistryRepo: "ghcr.io/eclipse-symphony" | |
jobs: | |
build: | |
if: github.repository == 'eclipse-symphony/symphony' && (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@v3 | |
- 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@v3 | |
with: | |
go-version: 1.21 # 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 dockerBuild | |
mage dockerBuildTargetAgent | |
mage dockerBuildPollAgent | |
- name: Build Symphony k8s | |
run: | | |
cd k8s | |
mage dockerBuild | |
- 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 | |
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/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 tag ${{ env.ContainerRegistryRepo }}/symphony-api ${{ env.ContainerRegistryRepo }}/symphony-api:${{ steps.increment_version.outputs.version }} | |
docker push ${{ env.ContainerRegistryRepo }}/symphony-api:${{ steps.increment_version.outputs.version }} | |
docker tag ${{ env.ContainerRegistryRepo }}/symphony-api:${{ steps.increment_version.outputs.version }} ${{ env.ContainerRegistryRepo }}/symphony-api:latest | |
docker push ${{ env.ContainerRegistryRepo }}/symphony-api:latest | |
docker tag ${{ env.ContainerRegistryRepo }}/symphony-target-agent ${{ env.ContainerRegistryRepo }}/symphony-target-agent:${{ steps.increment_version.outputs.version }} | |
docker push ${{ env.ContainerRegistryRepo }}/symphony-target-agent:${{ steps.increment_version.outputs.version }} | |
docker tag ${{ env.ContainerRegistryRepo }}/symphony-target-agent:${{ steps.increment_version.outputs.version }} ${{ env.ContainerRegistryRepo }}/symphony-target-agent:latest | |
docker push ${{ env.ContainerRegistryRepo }}/symphony-target-agent:latest | |
docker tag ${{ env.ContainerRegistryRepo }}/symphony-poll-agent ${{ env.ContainerRegistryRepo }}/symphony-poll-agent:${{ steps.increment_version.outputs.version }} | |
docker push ${{ env.ContainerRegistryRepo }}/symphony-poll-agent:${{ steps.increment_version.outputs.version }} | |
docker tag ${{ env.ContainerRegistryRepo }}/symphony-poll-agent:${{ steps.increment_version.outputs.version }} ${{ env.ContainerRegistryRepo }}/symphony-poll-agent:latest | |
docker push ${{ env.ContainerRegistryRepo }}/symphony-poll-agent:latest | |
- name: Push symphony k8s images | |
run: | | |
docker tag ${{ env.ContainerRegistryRepo }}/symphony-k8s ${{ env.ContainerRegistryRepo }}/symphony-k8s:${{ steps.increment_version.outputs.version }} | |
docker push ${{ env.ContainerRegistryRepo }}/symphony-k8s:${{ steps.increment_version.outputs.version }} | |
docker tag ${{ env.ContainerRegistryRepo }}/symphony-k8s:${{ steps.increment_version.outputs.version }} ${{ env.ContainerRegistryRepo }}/symphony-k8s:latest | |
docker push ${{ env.ContainerRegistryRepo }}/symphony-k8s: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.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
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.GITHUB_TOKEN }} | |
branch: main | |
- 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 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 |