diff --git a/.github/workflows/create-cms-pr.yml b/.github/workflows/create-cms-pr.yml index 7431be7858..5403b56df9 100644 --- a/.github/workflows/create-cms-pr.yml +++ b/.github/workflows/create-cms-pr.yml @@ -6,19 +6,30 @@ on: - completed jobs: - invoke-external-pr-workflow: + debugging: runs-on: ubuntu-latest steps: - - name: Debug - run: echo ${{ toJson(github.event.workflow_run) }} - - name: Debug II - run: echo ${{ toJson(github.event.workflow_run.head_repository ) }} - - name: Deploy Stage - uses: fjogeleit/http-request-action@v1 - with: - url: 'https://api.github.com/repos/reload/poc-dpl-cms-pr-trigger/dispatches' - method: 'POST' - customHeaders: '{"Accept": "application/vnd.github+json", "Authorization": "Bearer ${{ secrets.CMS_PR_CREATION_PAT }}" }' - data: '{"event_type":"create_pr","client_payload":{"branch":"${{ env.BRANCH_NAME }}", "build_url":"https://github.com/danskernesdigitalebibliotek/dpl-react/releases/download/branch-user-registration-form-v2/dist-user-registration-form-v2.zip"}}' - env: - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + - uses: actions/download-artifact@v4 + with: + name: release-info.json + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - name: Display structure of downloaded files + run: ls -R + + # invoke-external-pr-workflow: + # runs-on: ubuntu-latest + # steps: + # - name: Debug + # run: echo ${{ toJson(github.event.workflow_run) }} + # - name: Debug II + # run: echo ${{ toJson(github.event.workflow_run.head_repository ) }} + # - name: Deploy Stage + # uses: fjogeleit/http-request-action@v1 + # with: + # url: 'https://api.github.com/repos/reload/poc-dpl-cms-pr-trigger/dispatches' + # method: 'POST' + # customHeaders: '{"Accept": "application/vnd.github+json", "Authorization": "Bearer ${{ secrets.CMS_PR_CREATION_PAT }}" }' + # data: '{"event_type":"create_pr","client_payload":{"branch":"${{ env.BRANCH_NAME }}", "build_url":"https://github.com/danskernesdigitalebibliotek/dpl-react/releases/download/branch-user-registration-form-v2/dist-user-registration-form-v2.zip"}}' + # env: + # BRANCH_NAME: ${{ github.head_ref || github.ref_name }} diff --git a/.github/workflows/create-release-on-branch-changes.yml b/.github/workflows/create-release-on-branch-changes.yml index 5c08090b5b..3d6d165484 100644 --- a/.github/workflows/create-release-on-branch-changes.yml +++ b/.github/workflows/create-release-on-branch-changes.yml @@ -30,58 +30,70 @@ jobs: echo "DIST_FILENAME=dist-${RELEASE_BRANCH_SLUGGED}.zip" >> "$GITHUB_ENV" # Checkout the HEAD of the PR branch to get the latest commit message. - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Get release description - run: | - echo "RELEASE_DESCRIPTION=$(git show -s --format=%s)" >> "$GITHUB_ENV" + # - uses: actions/checkout@v4 + # with: + # ref: ${{ github.event.pull_request.head.sha }} + # - name: Get release description + # run: | + # echo "RELEASE_DESCRIPTION=$(git show -s --format=%s)" >> "$GITHUB_ENV" - - uses: actions/checkout@v4 - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - registry-url: 'https://npm.pkg.github.com' - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - uses: actions/checkout@v4 + # - name: Setup Node + # uses: actions/setup-node@v4 + # with: + # node-version-file: '.nvmrc' + # cache: 'yarn' + # registry-url: 'https://npm.pkg.github.com' + # env: + # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Dependencies - run: yarn install --frozen-lockfile + # - name: Install Dependencies + # run: yarn install --frozen-lockfile - - name: Build artifacts - run: yarn build - env: - VERSION_FILE_NAME: ${{ github.repository }} - VERSION_FILE_VERSION: ${{ env.BUILD_VERSION }} + # - name: Build artifacts + # run: yarn build + # env: + # VERSION_FILE_NAME: ${{ github.repository }} + # VERSION_FILE_VERSION: ${{ env.BUILD_VERSION }} - - name: Zip project - run: | - zip -r -j ${{ env.DIST_FILENAME }} dist/ + # - name: Zip project + # run: | + # zip -r -j ${{ env.DIST_FILENAME }} dist/ - - name: Delete existing releases - uses: dev-drprasad/delete-tag-and-release@v1.1 - with: - tag_name: ${{ env.TAG_NAME }} - github_token: ${{ secrets.GITHUB_TOKEN }} + # - name: Delete existing releases + # uses: dev-drprasad/delete-tag-and-release@v1.1 + # with: + # tag_name: ${{ env.TAG_NAME }} + # github_token: ${{ secrets.GITHUB_TOKEN }} - - name: Create or update tag - uses: EndBug/latest-tag@v1.6.2 - with: - ref: ${{ env.TAG_NAME }} + # - name: Create or update tag + # uses: EndBug/latest-tag@v1.6.2 + # with: + # ref: ${{ env.TAG_NAME }} - - name: Create release - id: create-release - uses: softprops/action-gh-release@v2 - with: - target_commitish: ${{ env.RELEASE_SHA }} - tag_name: ${{ env.TAG_NAME }} - body: ${{ env.RELEASE_DESCRIPTION }} - files: ${{ env.DIST_FILENAME }} + # - name: Create release + # id: create-release + # uses: softprops/action-gh-release@v2 + # with: + # target_commitish: ${{ env.RELEASE_SHA }} + # tag_name: ${{ env.TAG_NAME }} + # body: ${{ env.RELEASE_DESCRIPTION }} + # files: ${{ env.DIST_FILENAME }} - - name: Adding summary + - name: Write release information in artifact file run: | - echo "Release created 🚀😎 at: ${{ steps.create-release.outputs.url }}" >> $GITHUB_STEP_SUMMARY + printf '{ + "release_branch": ${{ env.RELEASE_BRANCH }}, + "release_download_url": "https://github.com/reload/poc-dpl-react-pr-trigger/releases/download/${{ env.RELEASE_BRANCH }}/${{ env.DIST_FILENAME }}", + }' >> release-info.json + + - uses: actions/upload-artifact@v3 + with: + name: release-info.json + path: ./ + + # - name: Adding summary + # run: | + # echo "Release created 🚀😎 at: ${{ steps.create-release.outputs.url }}" >> $GITHUB_STEP_SUMMARY