Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CPACK_PACKAGE_VERSION_MAJOR to 28 #11

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open
62 changes: 33 additions & 29 deletions .github/workflows/artifacts_build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
schedule:
- cron: "0 0 * * 3,6"
workflow_dispatch:
inputs:
is_release_build:
description: 'Is this a release build?'
required: false
default: 'false'

env:
artifact: 1
Expand All @@ -11,28 +16,27 @@ jobs:
prepare_build:
runs-on: ubuntu-22.04
outputs:
CI_TAG: ${{ steps.tag_set.outputs.CI_TAG }}
TAG_CREATED: ${{ steps.tag_set.outputs.tag_created }}
ci_tag: ${{ steps.set_vars.outputs.ci_tag }}
tag_created: ${{ steps.set_vars.outputs.tag_created }}
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
ref: ${{ github.ref }}
- name: Set the tag and version
id: tag_set
run: |
output_var_file="variable_list.txt"
ci/actions/generate_next_git_tag.sh -c -o "${output_var_file}"
CI_TAG=$(grep 'build_tag' ${output_var_file} | cut -d= -f2)
echo "CI_TAG=${CI_TAG}" >> $GITHUB_OUTPUT
TAG_CREATED=$(grep 'tag_created' ${output_var_file} | cut -d= -f2)
echo "TAG_CREATED=${TAG_CREATED}" >> $GITHUB_OUTPUT
ci/actions/generate_next_git_tag.sh -c
env:
GITHUB_ACTOR: ${{ github.actor }}
IS_RELEASE_BUILD: ${{ github.event.inputs.is_release_build || 'false' }}
- name: Set output
id: set_vars
run: |
echo "ci_tag=$CI_TAG" >> $GITHUB_OUTPUT
echo "tag_created=$TAG_CREATED" >> $GITHUB_OUTPUT


osx_job:
needs: prepare_build
if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }}
if: ${{ needs.prepare_build.outputs.tag_created == 'true' }}
runs-on: macOS-12
timeout-minutes: 90
strategy:
Expand All @@ -43,20 +47,20 @@ jobs:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
ref: ${{ needs.prepare_build.outputs.CI_TAG }}
ref: ${{ needs.prepare_build.outputs.ci_tag }}
repository: ${{ github.repository }}
- name: Prepare
run: ci/prepare/macos/prepare.sh
- name: Build Artifact
run: ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5";
env:
NETWORK: ${{ matrix.network }}
CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }}
CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }}
- name: Deploy Artifact
run: ci/actions/deploy.sh
env:
NETWORK: ${{ matrix.network }}
TAG: ${{ needs.prepare_build.outputs.CI_TAG }}
TAG: ${{ needs.prepare_build.outputs.ci_tag }}
S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }}
S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -66,7 +70,7 @@ jobs:

linux_job:
needs: prepare_build
if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }}
if: ${{ needs.prepare_build.outputs.tag_created == 'true' }}
runs-on: ubuntu-22.04
timeout-minutes: 90
strategy:
Expand All @@ -76,21 +80,21 @@ jobs:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
ref: ${{ needs.prepare_build.outputs.CI_TAG }}
ref: ${{ needs.prepare_build.outputs.ci_tag }}
repository: ${{ github.repository }}
- name: Prepare
run: sudo -E ci/prepare/linux/prepare.sh
- name: Build Artifact
run: ci/build-deploy.sh "/usr/lib/x86_64-linux-gnu/cmake/Qt5"
env:
NETWORK: ${{ matrix.network }}
CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }}
CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }}

- name: Deploy Artifact
run: ci/actions/deploy.sh
env:
NETWORK: ${{ matrix.network }}
TAG: ${{ needs.prepare_build.outputs.CI_TAG }}
TAG: ${{ needs.prepare_build.outputs.ci_tag }}
S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }}
S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -100,7 +104,7 @@ jobs:

linux_rpm_job:
needs: prepare_build
if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }}
if: ${{ needs.prepare_build.outputs.tag_created == 'true' }}
runs-on: ubuntu-22.04
timeout-minutes: 90
strategy:
Expand All @@ -125,7 +129,7 @@ jobs:
docker run -v ${GITHUB_WORKSPACE}:/workspace -v ${GITHUB_WORKSPACE}/artifacts:/root/rpmbuild \
local/nano-env:rhel /bin/bash -c " \
NETWORK=${{ matrix.network }} \
TAG=${{ needs.prepare_build.outputs.CI_TAG }} \
TAG=${{ needs.prepare_build.outputs.ci_tag }} \
REPO_TO_BUILD=${{ github.repository }} \
RPM_RELEASE=1 \
ci/build-rhel.sh"
Expand All @@ -135,7 +139,7 @@ jobs:
env:
LINUX_RPM: 1
NETWORK: ${{ matrix.network }}
# TAG: ${{ needs.prepare_build.outputs.CI_TAG }} # (not used in the deploy script if LINUX_RPM==1 )
# TAG: ${{ needs.prepare_build.outputs.ci_tag }} # (not used in the deploy script if LINUX_RPM==1 )
S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }}
S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -145,7 +149,7 @@ jobs:

linux_docker_job:
needs: prepare_build
if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }}
if: ${{ needs.prepare_build.outputs.tag_created == 'true' }}
runs-on: ubuntu-22.04
timeout-minutes: 90
strategy:
Expand All @@ -155,29 +159,29 @@ jobs:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
ref: ${{ needs.prepare_build.outputs.CI_TAG }}
ref: ${{ needs.prepare_build.outputs.ci_tag }}
repository: ${{ github.repository }}
- name: Build Docker
run: ci/actions/linux/docker-build.sh
env:
NETWORK: ${{ matrix.network }}
CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }}
CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }}
DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }}
- name: Check if secrets.DOCKER_PASSWORD exists
run: echo "DOCKER_PASSWORD_EXISTS=${{ secrets.DOCKER_PASSWORD != '' }}" >> $GITHUB_ENV
- name: Deploy Docker Hub
if: env.DOCKER_PASSWORD_EXISTS == 'true'
run: ci/actions/linux/docker-deploy.sh
env:
CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }}
CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }}
NETWORK: ${{ matrix.network }}
DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }}
DOCKER_USER: ${{ vars.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy Docker (ghcr.io)
run: ci/actions/linux/ghcr-deploy.sh
env:
CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }}
CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }}
NETWORK: ${{ matrix.network }}
DOCKER_REGISTRY: ghcr.io
DOCKER_USER: ${{ github.repository_owner }}
Expand All @@ -186,7 +190,7 @@ jobs:

windows_job:
needs: prepare_build
if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }}
if: ${{ needs.prepare_build.outputs.tag_created == 'true' }}
runs-on: windows-latest
timeout-minutes: 90
strategy:
Expand All @@ -196,7 +200,7 @@ jobs:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
with:
submodules: "recursive"
ref: ${{ needs.prepare_build.outputs.CI_TAG }}
ref: ${{ needs.prepare_build.outputs.ci_tag }}
repository: ${{ github.repository }}
- name: Prepare
run: ci/prepare/windows/prepare.ps1
Expand All @@ -209,7 +213,7 @@ jobs:
run: ci/actions/windows/deploy.ps1
env:
NETWORK: ${{ matrix.network }}
TAG: ${{ needs.prepare_build.outputs.CI_TAG }}
TAG: ${{ needs.prepare_build.outputs.ci_tag }}
S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }}
S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Prepare Release
name: Prepare Release
on:
workflow_dispatch:

Expand Down Expand Up @@ -37,25 +37,29 @@ jobs:
echo "Release branch does not exist. Continuing with preparation..."
echo "release-branch-name=${release_branch_name}" >> $GITHUB_OUTPUT
fi

- name: Get default branch
id: get-default-branch
run: |
DEFAULT_BRANCH=$(curl --silent --show-error --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}" | jq .default_branch --raw-output)
echo "Default branch is $DEFAULT_BRANCH"
echo "default-branch=${DEFAULT_BRANCH}" >> $GITHUB_OUTPUT
echo "default-branch=${DEFAULT_BRANCH}" >> $GITHUB_OUTPUT

- name: Increment Major version on default branch
run: |
git checkout ${{ steps.get-default-branch.outputs.default-branch }}
NEW_BRANCH="prs/temp-increment-major-$(date +%Y%m%d%H%M%S)"
git checkout -b $NEW_BRANCH
new_version_major=$((${{ steps.fetch-versions.outputs.major }} + 1))
sed -i.bak "s/set(CPACK_PACKAGE_VERSION_MAJOR \"[0-9]*\")/set(CPACK_PACKAGE_VERSION_MAJOR \"$new_version_major\")/g" CMakeLists.txt
rm CMakeLists.txt.bak
git add CMakeLists.txt
git commit -m "Update CPACK_PACKAGE_VERSION_MAJOR to $new_version_major"
git push origin ${{ steps.get-default-branch.outputs.default-branch }}
# Reset CPACK_PACKAGE_VERSION_MAJOR to its original value for the release branch
git reset --hard HEAD~1
git push origin $NEW_BRANCH
# Create pull request
export GH_TOKEN=${{ secrets.GITHUB_TOKEN }}
gh pr create --base ${{ steps.get-default-branch.outputs.default-branch }} --head $NEW_BRANCH --title "Update CPACK_PACKAGE_VERSION_MAJOR to $new_version_major" --body "Auto-generated PR to update CPACK_PACKAGE_VERSION_MAJOR"
git reset --hard HEAD~1

- name: Prepare release branch and set pre-release to 0
run: |
Expand All @@ -65,7 +69,3 @@ jobs:
git add CMakeLists.txt
git commit -m "Update CPACK_PACKAGE_VERSION_PRE_RELEASE to 0"
git push origin ${{ steps.check-release-branch.outputs.release-branch-name }}
shell: bash
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if(MSVC)
endif()

set(CPACK_PACKAGE_VENDOR "Nano Currency")
set(CPACK_PACKAGE_VERSION_MAJOR "27")
set(CPACK_PACKAGE_VERSION_MAJOR "28")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")

Expand Down
Loading