Skip to content

Commit

Permalink
feat: initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Oct 21, 2023
1 parent 4fd46bd commit 9017163
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 2 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: CI

on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
push:
branches: [master]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
action:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Release
id: setup-release
uses: LizardByte/setup-release-action@master
with:
changelog_path: ./tests/data/set${{ matrix.set }}/CHANGELOG.md
fail_on_events_api_error: false
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set action variables
id: vars
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
discussion_category=tests
publish_stable_release=False
release_tag=pr-${{ github.event.pull_request.number }}-${{ github.run_id }}
token=${{ secrets.GITHUB_TOKEN }}
else
discussion_category=announcements
publish_stable_release=${{ steps.setup-release.outputs.publish_stable_release }}
release_tag=${{ steps.setup-release.outputs.release_tag }}
token=${{ secrets.GH_BOT_TOKEN }}
fi
# set outputs
echo "discussion_category=$discussion_category" >> $GITHUB_OUTPUT
echo "publish_stable_release=$publish_stable_release" >> $GITHUB_OUTPUT
echo "release_tag=$release_tag" >> $GITHUB_OUTPUT
echo "token=$token" >> $GITHUB_OUTPUT
- name: Run Action
id: action
uses: ./
with:
allowUpdates: false
artifacts: ''
body: ''
discussionCategory: ${{ steps.vars.outputs.discussion_category }}
generateReleaseNotes: true
name: ${{ steps.vars.outputs.release_tag }}
prerelease: ${{ steps.vars.outputs.publish_stable_release != 'True' }}
tag: ${{ steps.vars.outputs.release_tag }}
token: ${{ steps.vars.outputs.token }}

- name: Delete Release
env:
GITHUB_TOKEN: ${{ steps.vars.outputs.token }}
if: ${{ github.event_name == 'pull_request' }}
uses: dev-drprasad/delete-tag-and-release@v0.2.1
with:
tag_name: ${{ steps.vars.outputs.release_tag }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ignore jetbrains files
.idea/
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# template-base
Base repository template for LizardByte.
# create-release-action
A reusable action to create a GitHub release. This action is tailored to the
@LizardByte organization, but can be used by anyone if they follow the same conventions.
58 changes: 58 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: "Create Release"
description: "A reusable action to create a GitHub release."
author: "LizardByte"
inputs:
allowUpdates:
description: 'An optional flag which indicates if we should update a release if it already exists.'
required: false
default: 'true'
artifacts:
description: 'The artifacts to upload.'
required: true
default: '*artifacts/*'
body:
description: 'The body of the release.'
required: true
discussionCategory:
description: 'The category of the discussion.'
required: false
default: 'announcements'
generateReleaseNotes:
description: 'Indicates if release notes should be automatically generated.'
required: false
default: 'false'
name:
description: 'The version to create.'
required: true
prerelease:
description: 'Whether the release is a prerelease.'
required: false
default: 'false'
tag:
description: 'The tag to create.'
required: true
token:
description: 'Github Token.'
required: true

runs:
using: "composite"
steps:
- name: Create/Update GitHub Release
if: >-
github.repository == 'LizardByte/create-release-action' ||
(github.event_name == 'push' && github.ref == 'refs/heads/master')
uses: ncipollo/release-action@v1.13.0
with:
allowUpdates: ${{ inputs.allowUpdates }}
artifactErrorsFailBuild: true
artifacts: ${{ inputs.artifacts }}
body: ${{ inputs.body }}
commit: ${{ github.sha }}
discussionCategory: ${{ inputs.discussionCategory }}
generateReleaseNotes: ${{ inputs.generateReleaseNotes }}
name: ${{ inputs.name }}
prerelease: ${{ inputs.prerelease }}
tag: ${{ inputs.tag }}
token: ${{ inputs.token }}

0 comments on commit 9017163

Please sign in to comment.