diff --git a/.github/workflows/common_tagging.yml b/.github/workflows/common_tagging.yml new file mode 100644 index 000000000..99987e3d7 --- /dev/null +++ b/.github/workflows/common_tagging.yml @@ -0,0 +1,55 @@ +name: Common Tagging Tasks + +on: + workflow_call: + inputs: + DIST_VERSION_PREFIX: + required: true + type: string + outputs: + next_tag: + description: "The next tag outputs string" + value: ${{ jobs.tagging.outputs.next_tag }} + +jobs: + tagging: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Determine Next Tag + id: determine_tag + run: | + YEAR=$(date +"%y") + MONTH=$(date +"%-m") + DAY=$(date +"%-d") + DATE_TAG="v${YEAR}.${MONTH}.${DAY}" + + git fetch --tags + + LATEST_TAG=$(git tag -l "${{ inputs.DIST_VERSION_PREFIX }}-${DATE_TAG}-*" | sort -V | tail -n 1) + + if [ -z "$LATEST_TAG" ]; then + NEXT_TAG="${DATE_TAG}-1" + else + COUNTER=$(echo "$LATEST_TAG" | awk -F '-' '{print $NF}') + NEXT_TAG="${DATE_TAG}-$((COUNTER + 1))" + fi + + FULL_TAG="${{ inputs.DIST_VERSION_PREFIX }}-$NEXT_TAG" + + echo "NEXT_TAG=$FULL_TAG" >> $GITHUB_ENV + echo "next_tag=$FULL_TAG" >> $GITHUB_OUTPUT + + - name: Create and Push Tag + run: | + git tag "$NEXT_TAG" + git push origin "$NEXT_TAG" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + outputs: + next_tag: ${{ steps.determine_tag.outputs.next_tag }} diff --git a/.github/workflows/executor_cd_preprod.yml b/.github/workflows/executor_cd_preprod.yml index 8d980c245..25f688983 100644 --- a/.github/workflows/executor_cd_preprod.yml +++ b/.github/workflows/executor_cd_preprod.yml @@ -29,21 +29,9 @@ jobs: echo "${{ secrets.DOCKERHUB_KEY }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin docker push "${IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "executor-preprod" diff --git a/.github/workflows/executor_cd_prod.yml b/.github/workflows/executor_cd_prod.yml index 9bd32a1da..5d5604676 100644 --- a/.github/workflows/executor_cd_prod.yml +++ b/.github/workflows/executor_cd_prod.yml @@ -29,21 +29,9 @@ jobs: echo "${{ secrets.DOCKERHUB_KEY }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin docker push "${IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "executor-prod" diff --git a/.github/workflows/executor_cd_staging.yml b/.github/workflows/executor_cd_staging.yml index d3585b874..ed2ade50c 100644 --- a/.github/workflows/executor_cd_staging.yml +++ b/.github/workflows/executor_cd_staging.yml @@ -31,21 +31,9 @@ jobs: docker push "${IMAGE_NAME}" docker push "${SHA_IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "executor-staging" diff --git a/.github/workflows/miner_cd_preprod.yml b/.github/workflows/miner_cd_preprod.yml index aa669ef9a..1279c4d8d 100644 --- a/.github/workflows/miner_cd_preprod.yml +++ b/.github/workflows/miner_cd_preprod.yml @@ -29,21 +29,9 @@ jobs: echo "${{ secrets.DOCKERHUB_KEY }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin docker push "${IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "miner-preprod" diff --git a/.github/workflows/miner_cd_prod.yml b/.github/workflows/miner_cd_prod.yml index 7c583578b..c78014f99 100644 --- a/.github/workflows/miner_cd_prod.yml +++ b/.github/workflows/miner_cd_prod.yml @@ -29,21 +29,9 @@ jobs: echo "${{ secrets.DOCKERHUB_KEY }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin docker push "${IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "miner-prod" diff --git a/.github/workflows/miner_cd_staging.yml b/.github/workflows/miner_cd_staging.yml index 7536f4d19..a593826b3 100644 --- a/.github/workflows/miner_cd_staging.yml +++ b/.github/workflows/miner_cd_staging.yml @@ -36,21 +36,9 @@ jobs: docker push "${IMAGE_NAME}" docker push "${SHA_IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "miner-staging" diff --git a/.github/workflows/miner_runner_cd_preprod.yml b/.github/workflows/miner_runner_cd_preprod.yml index 19d33b458..1e3b94809 100644 --- a/.github/workflows/miner_runner_cd_preprod.yml +++ b/.github/workflows/miner_runner_cd_preprod.yml @@ -56,21 +56,9 @@ jobs: docker push "${IMAGE_NAME}" docker push "${SHA_IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "miner-runner-preprod" diff --git a/.github/workflows/miner_runner_cd_prod.yml b/.github/workflows/miner_runner_cd_prod.yml index f9f91b964..c2e4a274a 100644 --- a/.github/workflows/miner_runner_cd_prod.yml +++ b/.github/workflows/miner_runner_cd_prod.yml @@ -56,21 +56,9 @@ jobs: docker push "${IMAGE_NAME}" docker push "${SHA_IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "miner-runner-prod" diff --git a/.github/workflows/miner_runner_cd_staging.yml b/.github/workflows/miner_runner_cd_staging.yml index 0073e481c..32ef51237 100644 --- a/.github/workflows/miner_runner_cd_staging.yml +++ b/.github/workflows/miner_runner_cd_staging.yml @@ -56,21 +56,9 @@ jobs: docker push "${IMAGE_NAME}" docker push "${SHA_IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "miner-runner-staging" diff --git a/.github/workflows/validator_cd_preprod.yml b/.github/workflows/validator_cd_preprod.yml index b0fce07b5..400b4e563 100644 --- a/.github/workflows/validator_cd_preprod.yml +++ b/.github/workflows/validator_cd_preprod.yml @@ -29,21 +29,9 @@ jobs: echo "${{ secrets.DOCKERHUB_KEY }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin docker push "${IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "validator-preprod" diff --git a/.github/workflows/validator_cd_prod.yml b/.github/workflows/validator_cd_prod.yml index f2e366b9f..4d23b8743 100644 --- a/.github/workflows/validator_cd_prod.yml +++ b/.github/workflows/validator_cd_prod.yml @@ -29,21 +29,9 @@ jobs: echo "${{ secrets.DOCKERHUB_KEY }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin docker push "${IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "validator-prod" diff --git a/.github/workflows/validator_cd_staging.yml b/.github/workflows/validator_cd_staging.yml index 70eb361fe..ef7035547 100644 --- a/.github/workflows/validator_cd_staging.yml +++ b/.github/workflows/validator_cd_staging.yml @@ -36,21 +36,9 @@ jobs: docker push "${IMAGE_NAME}" docker push "${SHA_IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "validator-staging" diff --git a/.github/workflows/validator_runner_cd_preprod.yml b/.github/workflows/validator_runner_cd_preprod.yml index 43fdc26d2..4f81ba641 100644 --- a/.github/workflows/validator_runner_cd_preprod.yml +++ b/.github/workflows/validator_runner_cd_preprod.yml @@ -37,21 +37,9 @@ jobs: docker push "${IMAGE_NAME}" docker push "${SHA_IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "validator-runner-preprod" diff --git a/.github/workflows/validator_runner_cd_prod.yml b/.github/workflows/validator_runner_cd_prod.yml index 7dbedfd1e..cbb064589 100644 --- a/.github/workflows/validator_runner_cd_prod.yml +++ b/.github/workflows/validator_runner_cd_prod.yml @@ -37,21 +37,9 @@ jobs: docker push "${IMAGE_NAME}" docker push "${SHA_IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "validator-runner-prod" diff --git a/.github/workflows/validator_runner_cd_staging.yml b/.github/workflows/validator_runner_cd_staging.yml index 6b05fb219..9cd00a7a1 100644 --- a/.github/workflows/validator_runner_cd_staging.yml +++ b/.github/workflows/validator_runner_cd_staging.yml @@ -37,21 +37,9 @@ jobs: docker push "${IMAGE_NAME}" docker push "${SHA_IMAGE_NAME}" - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - - name: Set Dist Version - run: | - BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" - echo "DIST_VERSION=${DIST_VERSION_PREFIX}-${{ steps.date.outputs.date }}-${BUILD_NUMBER}" >> $GITHUB_ENV - - name: Create Tag - uses: actions/github-script@v6 - with: - script: | - const {DIST_VERSION} = process.env - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${DIST_VERSION}`, - sha: context.sha - }) + + tagging: + needs: deploy + uses: ./.github/workflows/common_tagging.yml + with: + DIST_VERSION_PREFIX: "validator-runner-staging" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..e69de29bb diff --git a/changelog.d/.gitkeep b/changelog.d/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/pyproject.toml b/pyproject.toml index 2c5c336a2..c64f28be1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,4 +12,34 @@ dev = [ "-e file:///${PROJECT_ROOT}/miner", "-e file:///${PROJECT_ROOT}/executor", "-e file:///${PROJECT_ROOT}/validator", -] \ No newline at end of file +] + +[tool.towncrier] +directory = "changelog.d" +filename = "CHANGELOG.md" +version = "0.0.1" + +[[tool.towncrier.section]] +name = "New Features" +path = "features" +showcontent = true + +[[tool.towncrier.section]] +name = "Bug Fixes" +path = "bugfixes" +showcontent = true + +[[tool.towncrier.section]] +name = "Documentation" +path = "docs" +showcontent = true + +[[tool.towncrier.section]] +name = "Removals" +path = "removals" +showcontent = true + +[[tool.towncrier.section]] +name = "Miscellaneous" +path = "miscs" +showcontent = true