github.com/webdestroya/awsmocker@v0.2.6/.github/workflows/release.yml (about)

     1  name: Release
     2  
     3  on:
     4    workflow_dispatch:
     5      inputs:
     6        version:
     7          description: "The version to release (must be prefixed with 'v')"
     8          required: true
     9  
    10  env:
    11    VERSION: ${{ github.event.inputs.version }}
    12  
    13  permissions:
    14    contents: write
    15  
    16  jobs:
    17  
    18    create_release_tag:
    19      name: Create Tag
    20      runs-on: ubuntu-latest
    21      steps:
    22  
    23        - name: Trim asset version prefix and Validate
    24          run: |-
    25            echo $VERSION
    26            trim=${VERSION#"v"}
    27            echo $trim
    28            if [[ $trim =~  ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
    29              echo "Version OK: $trim"
    30            else
    31              echo "Invalid version: $trim"
    32              exit 1
    33            fi
    34            echo "VERSION=${trim}" >> $GITHUB_ENV
    35            
    36        - name: Checkout
    37          uses: actions/checkout@v3
    38          with:
    39            ref: ${{ github.event.ref }}
    40  
    41        - name: Unshallow
    42          run: git fetch --prune --unshallow
    43  
    44        - name: Tag Release
    45          run: |
    46            git config user.name "Cloud87 GitHub Actions Bot"
    47            git config user.email 114977785+cloud87bot@users.noreply.github.com
    48            git tag -a ${{ github.event.inputs.version }} -m ${{ github.event.inputs.version }}
    49            git push origin ${{ github.event.inputs.version }}
    50  
    51    goreleaser:
    52      name: GoReleaser
    53      runs-on: ubuntu-latest
    54      needs: [create_release_tag]
    55      steps:
    56        - name: Checkout
    57          uses: actions/checkout@v3
    58          with:
    59            fetch-depth: 0
    60            ref: ${{ github.event.inputs.version }}
    61          
    62        - name: Set up Go
    63          uses: actions/setup-go@v3
    64          with:
    65            go-version-file: .go-version
    66  
    67        - name: Run GoReleaser
    68          uses: goreleaser/goreleaser-action@v3
    69          with:
    70            args: release --rm-dist
    71          env:
    72            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}