From 5c23a3e52c415d0321b40e1efa853eabddade46c Mon Sep 17 00:00:00 2001 From: David Losada Carballo Date: Sun, 21 Jan 2024 22:33:08 +0100 Subject: [PATCH] add release job --- .github/workflows/release.yml | 56 +++++++++++++++++++++++++++++++++++ build_env.sh | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cf3c8d7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release + +on: +- push +- pull_request + +env: + MYSQL_ROOT_PASSWORD: root + +jobs: + release: + runs-on: ubuntu-latest + timeout-minutes: 30 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + + steps: + - uses: actions/checkout@v3 + + - name: Set version number + id: version + run: | + RELEASE_VERSION="${GITHUB_REF##*/}"; + RELEASE_FILE="ushahidi-platform-release-${RELEASE_VERSION}.tar.gz" + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_OUTPUT + echo "RELEASE_FILE=${RELEASE_FILE}" >> $GITHUB_OUTPUT + + - name: Build image + uses: docker/build-push-action@v3 + with: + context: . + push: false + load: true + tags: local/platform-release:latest + build-args: | + GIT_COMMIT_ID=${{ github.sha }} + GIT_BUILD_REF=${{ github.head_ref }} + + - name: Prepare folder + run: + mkdir -p tmp/out + + - name: Create release file + uses: addnab/docker-run-action@v3 + with: + image: local/platform-release:latest + run: /bin/bash /entrypoint.CES.sh build + options: | + -e RELEASE_VERSION=${{ steps.version.outputs.RELEASE_VERSION }} + -v ${{ github.workspace }}/tmp/out:/vols/out + + - name: Upload tarball + uses: softprops/action-gh-release@v1 + with: + draft: true + files: | + tmp/out/${{ steps.version.outputs.RELEASE_FILE }} \ No newline at end of file diff --git a/build_env.sh b/build_env.sh index dfef74a..f83f46f 100644 --- a/build_env.sh +++ b/build_env.sh @@ -1,6 +1,6 @@ client_version=v2024.03.0 api_version=v2024.03.0 -release_version=${CI_BRANCH:-v6.0.0} +release_version=${RELEASE_VERSION:-v6.0.0} client_url= api_url=