Skip to content

flex-development/gh-release-url-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

gh-release-url

github release test module type: esm license conventional commits yarn

Create a URL for a GitHub release

Contents

What is this?

This is a simple, but useful, action for creating GitHub release URLs.

Use

---
name: release
on:
  pull_request:
    branches:
      - main
    types:
      - closed
env:
  REF: ${{ github.event.pull_request.merge_commit_sha }}
  REF_NAME: ${{ format('{0}@{1}', github.base_ref, github.event.pull_request.merge_commit_sha) }}
jobs:
  preflight:
    if: github.event.pull_request.merged && startsWith(github.head_ref, 'release/')
    permissions:
      contents: read
    runs-on: ubuntu-latest
    outputs:
      tag: ${{ steps.environment.outputs.tag }}
      url: ${{ steps.environment.outputs.url }}
      version: ${{ steps.version.outputs.manifest }}
    steps:
      - id: checkout
        name: Checkout ${{ env.REF_NAME }}
        uses: actions/[email protected]
        with:
          ref: ${{ env.REF }}
      - id: version
        name: Get release version
        uses: flex-development/[email protected]
      - id: tag-prefix
        name: Get release tag prefix
        uses: flex-development/[email protected]
        with:
          data: grease.config.json
          filter: .tagprefix
      - id: environment
        name: Get release url
        uses: flex-development/[email protected]
        with:
          tag-prefix: ${{ steps.tag-prefix.outputs.result }}
          version: ${{ steps.version.outputs.manifest }}
  publish:
    needs: preflight
    runs-on: ubuntu-latest
    environment:
      name: release
      url: ${{ needs.preflight.outputs.url }}
    env:
      GITHUB_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
      NOTES_FILE: RELEASE_NOTES.md
    steps:
      - id: checkout
        name: Checkout ${{ env.REF_NAME }}
        uses: actions/[email protected]
        with:
          fetch-depth: 0
          persist-credentials: true
          ref: ${{ env.REF }}
          token: ${{ env.GITHUB_TOKEN }}
      - id: gpg-import
        name: Import GPG key
        uses: crazy-max/[email protected]
        with:
          git_config_global: true
          git_push_gpgsign: false
          git_tag_gpgsign: true
          git_user_signingkey: true
          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
          passphrase: ${{ secrets.GPG_PASSPHRASE }}
          trust_level: 5
      - id: node
        name: Setup Node.js
        uses: actions/[email protected]
        with:
          cache: yarn
          cache-dependency-path: yarn.lock
          node-version-file: .nvmrc
      - id: yarn
        name: Install dependencies
        run: yarn --no-immutable && echo "$GITHUB_WORKSPACE/node_modules/.bin" >>$GITHUB_PATH
      - id: pack
        name: Pack project
        run: yarn pack -o %s-%v.tgz
      - id: release-notes
        name: Generate release notes
        env:
          TZ: ${{ vars.TZ }}
        run: grease changelog -wo $NOTES_FILE && echo "$(cat $NOTES_FILE)" >>$GITHUB_STEP_SUMMARY
      - id: tag
        name: Create annotated tag
        run: 'grease tag -ps -m "release: {tag}" ${{ needs.preflight.outputs.version }}'
      - id: publish
        name: Publish release
        run: |
          gh release create ${{ needs.preflight.outputs.tag }} *.tgz --title=${{ needs.preflight.outputs.tag }} --notes-file=$NOTES_FILE --verify-tag

Inputs

artifact

The name of the release artifact to create a download URL for (optional).

owner

default: ${{ github.repository_owner }}

The repository owner (optional).

repo

default: ${{ github.event.repository.name }}

The name of the repository (optional).

server

default: ${{ github.server_url }}

The URL of the GitHub server (optional).

tag-prefix

The prefix to append to the release version when building the release tag component of the URL (optional).

version

The release version or tag to create a URL for.

Outputs

artifact

The release artifact download URL.

tag

The release tag the URLs were created with.

url

The release URL.

Related

Contribute

See CONTRIBUTING.md.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.