Skip to content

Commit

Permalink
ci: create release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
misa198 committed Dec 23, 2021
1 parent a195240 commit 7307107
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
paths:
- 'EFI/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Manage Version
run: |
git fetch --prune --unshallow --tags
GIT_SHA="$(git rev-parse --short HEAD)"
CUR_TAG="$(git tag -l | grep 'pre-release' | tail -1)"
echo "SHORT_SHA=$GIT_SHA" >> $GITHUB_ENV
if [[ -z $CUR_TAG ]]; then
echo "OLD_PRE_TAG=NULL" >> $GITHUB_ENV
else
echo "OLD_PRE_TAG=$CUR_TAG" >> $GITHUB_ENV
fi
# Runs a single command using the runners shell
- name: Zip EFI folder
run: zip -r EFI.zip EFI

- name: Generate Prerelease Release Notes
run: |
echo '### Disclaimer:' >> ReleaseNotes.md
echo 'This version is auto-created by Github Action.' >> ReleaseNotes.md
echo 'It is not ready for daily use and I do not guarantee its usability.' >> ReleaseNotes.md
echo '### The latest five updates are:' >> ReleaseNotes.md
git log -"5" --format="- %H %s" | sed '/^$/d' >> ReleaseNotes.md
- name: Delete Old Prerelease
uses: dev-drprasad/delete-tag-and-release@v0.1.2
with:
tag_name: ${{ env.OLD_PRE_TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish GitHub Release
uses: ncipollo/release-action@v1
with:
prerelease: true
bodyFile: ReleaseNotes.md
artifacts: "EFI.zip"
name: "EFI Pre-release"
tag: "pre-release"
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 7307107

Please sign in to comment.