From bac75367ba2aced55fd8976cdf995061094310d6 Mon Sep 17 00:00:00 2001 From: Daisuke Sato Date: Mon, 23 Sep 2024 19:44:04 -0400 Subject: [PATCH 1/5] add setup-dependency.sh Signed-off-by: Daisuke Sato --- setup-dependency.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/setup-dependency.sh b/setup-dependency.sh index 0e7969c8..1bc758f1 100755 --- a/setup-dependency.sh +++ b/setup-dependency.sh @@ -32,12 +32,14 @@ function help { echo "-h show this help" echo "-c clean (rm -rf) dependency repositories" echo "-n max count for recursive check (default=2)" + echo "-r update depedency-release.repos" } clean=0 count=3 +release=0 -while getopts "hcn:" arg; do +while getopts "hcn:r" arg; do case $arg in h) help @@ -49,9 +51,20 @@ while getopts "hcn:" arg; do n) count=$OPTARG ;; + r) + release=1 + ;; esac done +## export dependencies to dependency-release.repos +if [[ $release -eq 1 ]]; then + mv .git .git-back # work around to eliminate the current repository itself + vcs export -n --exact-with-tags > dependency-release.repos + mv .git-back .git # restore the .git dir + exit +fi + if [[ $clean -eq 1 ]]; then pwd=$(pwd) @@ -68,6 +81,16 @@ if [[ $clean -eq 1 ]]; then exit fi + +## for release +if [[ -e dependency-release.repos ]]; then + echo "setup dependency from release" + vcs import < dependency-release.repos + exit +fi + + +## for dev declare -A visited for (( i=1; i<=count; i++ )) From 1c3f9680733639ec03912685c80c6b2ec8986ece Mon Sep 17 00:00:00 2001 From: Daisuke Sato Date: Wed, 25 Sep 2024 20:22:28 -0400 Subject: [PATCH 2/5] add build-release.yaml action Signed-off-by: Daisuke Sato --- .github/workflows/build-release.yaml | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/build-release.yaml diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml new file mode 100644 index 00000000..4766d958 --- /dev/null +++ b/.github/workflows/build-release.yaml @@ -0,0 +1,30 @@ +name: Create Release + +on: + push: + tags: + - 'v*.*.*' # Matches tags like v1.2.3 + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Export release dependency + run: ./setup-dependency.sh -r + + - name: Create zip file + run: | + name=$(basename $(pwd)) + cd .. + zip -r cabot-${{ github.ref_name }}.zip ${name} + + - name: Create GitHub Release + id: create_release + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: ./*.zip From d3bb91e6aac52871c6aaf0f7ea7da08e74bc8798 Mon Sep 17 00:00:00 2001 From: Daisuke Sato Date: Wed, 25 Sep 2024 20:38:42 -0400 Subject: [PATCH 3/5] update build-release.yaml action Signed-off-by: Daisuke Sato --- .github/workflows/build-release.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 4766d958..e622741c 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -10,11 +10,27 @@ jobs: runs-on: ubuntu-latest steps: + - name: Set up Python + uses: actions/setup-python@v4 + + - name: Install vcstool + run: | + pip install vcstool + - name: Checkout code uses: actions/checkout@v4 - name: Export release dependency - run: ./setup-dependency.sh -r + run: | + # copy the checkout dir + cd .. + cp -r cabot cabot-temp + cd cabot-temp + # get all depedencies and freeze + ./setup-dependency.sh + ./setup-dependency.sh -r + # copy the release repos file + cp dependency-release.repos ../cabot - name: Create zip file run: | From c623eec4e4385e56ae8a59e63ccba368305862e1 Mon Sep 17 00:00:00 2001 From: Daisuke Sato Date: Wed, 25 Sep 2024 20:44:37 -0400 Subject: [PATCH 4/5] improve build-release.yaml Signed-off-by: Daisuke Sato --- .github/workflows/build-release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index e622741c..ed818303 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -34,6 +34,7 @@ jobs: - name: Create zip file run: | + rm -rf .git name=$(basename $(pwd)) cd .. zip -r cabot-${{ github.ref_name }}.zip ${name} @@ -43,4 +44,4 @@ jobs: uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - artifacts: ./*.zip + artifacts: ../cabot-*.zip From 1ec9f555dbf83cbd97969ddd1b9a34a5edeb161f Mon Sep 17 00:00:00 2001 From: tisihara Date: Fri, 4 Oct 2024 17:18:55 +0900 Subject: [PATCH 5/5] add build docker step in build-release.yaml DCO 1.1 Signed-off-by: Tatsuya Ishihara --- .github/workflows/build-release.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index ed818303..0f9efd30 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -45,3 +45,13 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} artifacts: ../cabot-*.zip + + - name: Build docker image + run: | + curl -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.CABOT_BUILD_TOKEN}}" \ + https://api.github.com/repos/CMU-cabot/cabot-build/dispatches \ + -d '{"event_type": "build-release", "client_payload":{"ref_name": "${{ github.ref_name }}"}}' + env: + PAT: ${{ secrets.CABOT_BUILD_TOKEN }}