name: publish on: push: branches: - master jobs: ############################################################################## # JOB: GITHUB TAG LATEST VERSION ############################################# ############################################################################## github_tag: name: Tag latest version on Github runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7 with: fetch-depth: 0 # Fetch full History for changelog - name: Setup env run: | echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - name: package-version-to-git-tag + build number uses: pkgdeps/git-tag-action@v3.0.0 # v3.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} github_repo: ${{ github.repository }} version: ${{ env.BUILD_VERSION }} git_commit_sha: ${{ github.sha }} git_tag_prefix: "b" - name: Generate changelog run: | yarn install yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only - name: package-version-to-git-release continue-on-error: true # Will fail if tag exists id: create_release uses: actions/create-release@4c11c9fe1dcd9636620a16455165783b20fc7ea0 # v1.1.4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token with: tag_name: ${{ env.VERSION }} release_name: ${{ env.VERSION }} body_path: ./CHANGELOG.md draft: false prerelease: false build_trigger: name: Trigger successful build runs-on: ubuntu-latest needs: [github_tag] steps: - name: Checkout code uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7 with: fetch-depth: 0 # Fetch full History for changelog - name: Setup env run: | echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV #- name: Repository Dispatch # uses: peter-evans/repository-dispatch@d2c43ab06ec1cddd2c2a0aae659681b8465ce87a # v3.0.0 # with: # token: ${{ github.token }} # event-type: trigger-ocelot-build-success # repository: ${{ github.repository }} # client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "VERSION": "${VERSION}", "BUILD_DATE": "${BUILD_DATE}", "BUILD_COMMIT": "${BUILD_COMMIT}", "BUILD_VERSION": "${BUILD_VERSION}"}' - name: Repository Dispatch stage.ocelot.social uses: peter-evans/repository-dispatch@d2c43ab06ec1cddd2c2a0aae659681b8465ce87a # v3.0.0 with: token: ${{ secrets.OCELOT_PUBLISH_EVENT_PAT }} # this token is required to access the other repository event-type: trigger-ocelot-build-success repository: 'Ocelot-Social-Community/stage.ocelot.social' client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "GITHUB_RUN_NUMBER": "${{ env.GITHUB_RUN_NUMBER }}", "VERSION": "${VERSION}", "BUILD_DATE": "${BUILD_DATE}", "BUILD_COMMIT": "${BUILD_COMMIT}", "BUILD_VERSION": "${BUILD_VERSION}"}' - name: Repository Dispatch stage.yunite.me uses: peter-evans/repository-dispatch@d2c43ab06ec1cddd2c2a0aae659681b8465ce87a # v3.0.0 with: token: ${{ secrets.OCELOT_PUBLISH_EVENT_PAT }} # this token is required to access the other repository event-type: trigger-ocelot-build-success repository: 'Yunite-Net/stage.yunite.me' client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "GITHUB_RUN_NUMBER": "${{ env.GITHUB_RUN_NUMBER }}", "VERSION": "${VERSION}", "BUILD_DATE": "${BUILD_DATE}", "BUILD_COMMIT": "${BUILD_COMMIT}", "BUILD_VERSION": "${BUILD_VERSION}"}'