diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d61187f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ + +name: Release +on: + push: + branches: [ main ] + tags-ignore: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: echo VERSION=$((${{ github.run_number }})) >> $GITHUB_ENV + + - uses: actions/checkout@v3 + - name: Create a Release + uses: apptimedev/github-actions-release@main + env: + GITHUB_TOKEN: ${{ github.token }} + with: + version: v${{ env.VERSION }} + description: Release version - ${{ env.VERSION }} diff --git a/README.md b/README.md index 24b88e0..fa67c0c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ # github-actions-release -Create GitHub Release with GitHub Actions. + +[![Actions Status](https://github.com/apptimedev/github-actions-release/workflows/Release/badge.svg)](https://github.com/apptimedev/github-actions-release/actions) + +Creates a GitHub Release with GitHub Actions. + +## Usage + +```yaml +name: Publish Release +on: + push: + branches: + - release +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Create a Release + uses: apptimedev/github-actions-release@v3 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + version: v1.0.0 + description: My Release +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..51a0da9 --- /dev/null +++ b/action.yml @@ -0,0 +1,24 @@ +name: "Github Release" +author: "Apptime Developers" +branding: + icon: "git-branch" + color: "gray-dark" +description: "Publish Github releases from an action" + +inputs: + version: + description: "The version of the release to publish" + required: true + + description: + description: "The description of the release to publish" + required: true + +runs: + using: 'composite' + steps: + - run: $GITHUB_ACTION_PATH/entrypoint.sh + shell: bash + env: + INPUT_VERSION: ${{ inputs.version }} + INPUT_DESCRIPTION: ${{ inputs.description }} diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..40a39d0 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,2 @@ +#!/bin/sh +gh release create "${INPUT_VERSION}" --notes "${INPUT_DESCRIPTION}" \ No newline at end of file