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

deprecated actions #283

Closed
freddydk opened this issue Nov 12, 2022 · 1 comment
Closed

deprecated actions #283

freddydk opened this issue Nov 12, 2022 · 1 comment
Assignees
Labels
Shipped Feature is included in the latest version

Comments

@freddydk
Copy link
Contributor

The following GitHub actions have been deprecated.
actions/create-release
actions/upload-release-asset

Need to refactor Create Release pipeline to not use these actions

@freddydk freddydk added the Under Investigation Issue is under investigation label Nov 12, 2022
@freddydk freddydk self-assigned this Nov 14, 2022
@freddydk
Copy link
Contributor Author

freddydk commented Dec 3, 2022

Implementation

The usage of these actions will be modified into using actions/github-script and then a few javascript code lines utilizing the REST API, like:

      - name: Create release
        uses: actions/github-script@v6
        id: createrelease
        env:
          bodyMD: ${{ steps.createreleasenotes.outputs.releaseNotes }}
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            var bodyMD = process.env.bodyMD
            const createReleaseResponse = await github.rest.repos.createRelease({
              owner: context.repo.owner,
              repo: context.repo.repo,
              tag_name: '${{ github.event.inputs.tag }}',
              name: '${{ github.event.inputs.name }}',
              body: bodyMD.replaceAll('\\n','\n'),
              draft: ${{ github.event.inputs.draft=='Y' }},
              prerelease: ${{ github.event.inputs.prerelease=='Y' }},
              target_commitish: '${{ steps.analyzeartifacts.outputs.commitish }}'
            });
            const {
              data: { id: releaseId, html_url: htmlUrl, upload_url: uploadUrl }
            } = createReleaseResponse;
            core.setOutput('releaseId', releaseId);

and

      - name: Upload release artifacts
        uses: actions/github-script@v6
        env:
          releaseId: ${{ needs.createrelease.outputs.releaseId }}
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            const releaseId = process.env.releaseId
            const assetPath = '${{ matrix.name }}.zip'
            const assetName = '${{ matrix.name }}.zip'
            const fs = require('fs');
            const uploadAssetResponse = await github.rest.repos.uploadReleaseAsset({
              owner: context.repo.owner,
              repo: context.repo.repo,
              release_id: releaseId,
              name: assetName,
              data: fs.readFileSync(assetPath)
            });

@freddydk freddydk added In Progress Issue is actively being worked on and removed Under Investigation Issue is under investigation labels Dec 3, 2022
@freddydk freddydk mentioned this issue Dec 4, 2022
@freddydk freddydk added In Preview Currently available in AL-Go for GitHub preview and removed In Progress Issue is actively being worked on labels Dec 6, 2022
@freddydk freddydk added Shipped Feature is included in the latest version and removed In Preview Currently available in AL-Go for GitHub preview labels Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Shipped Feature is included in the latest version
Projects
Status: v2.3
Development

No branches or pull requests

1 participant