diff --git a/.circleci/config.yml b/.circleci/config.yml index e6c9b0ccc0..63f1dd4ce8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,115 +93,6 @@ jobs: - store_artifacts: path: bids-spec.pdf - # Automatically generate a changelog since migration from Google Docs to GitHub - github_changelog_generator: - docker: - - image: cimg/ruby:3.2 - steps: - # checkout code to default ~/project - - checkout - - run: - name: install github_changelog_generator - command: | - gem install github_changelog_generator - - run: - name: check version - command: | - github_changelog_generator --version - - run: - name: Build changelog - # $CHANGELOG_GITHUB_TOKEN was generated via the GitHub web UI of the `bids-maintenance` - # GitHub user (see https://github.com/settings/tokens), and was then securely stored within - # CircleCI web UI as an environment variable ("classic token", "repo scope", no expiration). - command: | - mkdir ~/changelog_build - github_changelog_generator \ - --exclude-tags-regex "^(?!v).*?$" \ - --user bids-standard \ - --project bids-specification \ - --token ${CHANGE_TOKEN} \ - --output ~/changelog_build/CHANGES.md \ - --header-label "# Changelog" \ - --release-branch master \ - --no-issues \ - --no-filter-by-milestone \ - --no-compare-link \ - --pr-label "" \ - --enhancement-label "" \ - --bugs-label "" \ - --exclude-labels "exclude-from-changelog" - - run: - name: append changelog from pre-GitHub times - command: | - cat ~/project/src/pregh-changes.md >> ~/changelog_build/CHANGES.md - - run: - name: print out complete changelog - command: | - cat ~/changelog_build/CHANGES.md - - persist_to_workspace: - # raw generated changelog in ~/changelog_build/CHANGES.md - root: ~/. - paths: - - changelog_build - - # Lint and fix the auto generated changes.md file - lint_generated_changelog: - docker: - - image: cimg/node:lts - steps: - # checkout code to default ~/project - - checkout - - attach_workspace: - # the freshly built CHANGES.md will be in ~/changelog_build/CHANGES.md - at: ~/. - - run: - name: install remark and extensions - command: npm install `cat npm-requirements.txt` - - run: - name: remark on autogenerated CHANGES.md - # format changelog, then use sed to change * to -, then lint changelog - command: | - head -n 100 ~/changelog_build/CHANGES.md - npx remark-cli ~/changelog_build/CHANGES.md --rc-path ~/project/.remarkrc --output ~/changelog_build/CHANGES.md - head -n 100 ~/changelog_build/CHANGES.md - sed -i 's/* /- /' ~/changelog_build/CHANGES.md - head -n 100 ~/changelog_build/CHANGES.md - npx remark-cli ~/changelog_build/CHANGES.md --frail --rc-path ~/project/.remarkrc - - persist_to_workspace: - # linted and fixed changelog in ~/changelog_build/CHANGES.md - root: ~/. - paths: - - changelog_build - - # Push built changelog to repo (only if if last commit was a "Merge commit" on master) - commit_generated_changelog: - docker: - - image: cimg/base:stable - steps: - - setup_remote_docker - # checkout code to default ~/project - - checkout - - attach_workspace: - # fixed+linted changelog in ~/changelog_build/CHANGES.md - at: ~/. - - run: - name: Changelog deployment - # $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI - command: | - if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then - mv ~/changelog_build/CHANGES.md ~/project/src/CHANGES.md - merge_message=$(git log -1 | grep Merge | grep "pull") - PR_number=$(echo $merge_message | cut -d ' ' -f 4) - git config credential.helper 'cache --timeout=120' - git config user.email "bids.maintenance@gmail.com" - git config user.name "bids-maintenance" - git add ~/project/src/CHANGES.md - git commit -m "[DOC] Auto-generate changelog entry for PR ${PR_number}" - git push https://${CHANGE_TOKEN}@github.com/bids-standard/bids-specification.git master - else - echo "Did not detect a "Merge commit" to master, or detected a Release ... doing nothing." - fi - workflows: search_build: jobs: @@ -209,14 +100,4 @@ workflows: - check_links: requires: - build_docs - - github_changelog_generator - - lint_generated_changelog: - requires: - - github_changelog_generator - - commit_generated_changelog: - requires: - - lint_generated_changelog - filters: - branches: - only: master - build_docs_pdf diff --git a/.github/workflows/changelog_generator.yml b/.github/workflows/changelog_generator.yml index 3a3573f4b0..f29a99cb39 100644 --- a/.github/workflows/changelog_generator.yml +++ b/.github/workflows/changelog_generator.yml @@ -8,8 +8,8 @@ on: branches: ["**"] concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} + cancel-in-progress: true jobs: github_changelog_generator: @@ -50,7 +50,74 @@ jobs: --exclude-labels "exclude-from-changelog" - name: Append changelog from pre-GitHub times run: | - cat ${{ github.workspace }}/${{ github.repository }}/src/pregh-changes.md >> ${{ github.workspace }}/changelog_build/CHANGES.md + cat ${{ github.workspace }}/src/pregh-changes.md >> ~/changelog_build/CHANGES.md - name: Print out complete changelog run: | - cat ${{ github.workspace }}/changelog_build/CHANGES.md + cat ~/changelog_build/CHANGES.md + - name: Archive changelog + uses: actions/upload-artifact@v4 + with: + name: changelog_pre_lint + path: | + ~/changelog_build/CHANGES.md + + lint_generated_changelog: + needs: github_changelog_generator + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download previously build changelog + uses: actions/download-artifact@v4 + with: + name: changelog_pre_lint + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install remark and extensions + run: | + npm install `cat npm-requirements.txt` + - name: Remark on autogenerated CHANGES.md + run: | + head -n 100 ~/changelog_build/CHANGES.md + npx remark-cli ~/changelog_build/CHANGES.md --rc-path ${{ github.workspace }}/.remarkrc --output ~/changelog_build/CHANGES.md + head -n 100 ~/changelog_build/CHANGES.md + sed -i 's/* /- /' ~/changelog_build/CHANGES.md + head -n 100 ~/changelog_build/CHANGES.md + npx remark-cli ~/changelog_build/CHANGES.md --frail --rc-path ${{ github.workspace }}/.remarkrc + - name: Archive linted changelog + uses: actions/upload-artifact@v4 + with: + name: changelog_post_lint + path: | + ~/changelog_build/CHANGES.md + + commit_generated_changelog: + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + needs: lint_generated_changelog + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download previously build changelog + uses: actions/download-artifact@v4 + with: + name: changelog_post_lint + - name: Changelog deployment + run: | + if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then + mv ~/changelog_build/CHANGES.md ${{ github.workspace }}/src/CHANGES.md + merge_message=$(git log -1 | grep Merge | grep "pull") + PR_number=$(echo $merge_message | cut -d ' ' -f 4) + git config credential.helper 'cache --timeout=120' + git config user.email "bids.maintenance@gmail.com" + git config user.name "bids-maintenance" + git add ${{ github.workspace }}/src/CHANGES.md + git commit -m "[DOC] Auto-generate changelog entry for PR ${PR_number}" + git push https://${{ secrets.GITHUB_TOKEN }}@github.com/bids-standard/bids-specification.git master + else + echo "Did not detect a "Merge commit" to master, or detected a Release ... doing nothing." + fi diff --git a/.github/workflows/schemacode_ci.yml b/.github/workflows/schemacode_ci.yml index 0b92cd9a4d..14746534db 100644 --- a/.github/workflows/schemacode_ci.yml +++ b/.github/workflows/schemacode_ci.yml @@ -117,8 +117,8 @@ jobs: with: user: __token__ password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - skip_existing: true + repository-url: https://test.pypi.org/legacy/ + skip-existing: true - name: "Upload to PyPI (on tags)" if: startsWith(github.ref, 'refs/tags/schema-') uses: pypa/gh-action-pypi-publish@release/v1