Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: "Release" | ||
|
||
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags | ||
on: | ||
push: | ||
tags: | ||
- v1* | ||
|
||
jobs: | ||
plugin: | ||
name: release-plugin | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
################################################################################################################## | ||
################################################################################################################## | ||
################################################################################################################## | ||
# Git checkout | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# The github.ref is, for example, refs/tags/v5.0.145 or refs/tags/v5.0-r8 | ||
# Generate variables like: | ||
# SRS_TAG=v5.0-r8 | ||
# SRS_TAG=v5.0.145 | ||
# @see https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable | ||
- name: Generate varaiables | ||
run: | | ||
SRS_TAG=$(echo ${{ github.ref }}| awk -F '/' '{print $3}') | ||
echo "SRS_TAG=$SRS_TAG" >> $GITHUB_ENV | ||
################################################################################################################## | ||
################################################################################################################## | ||
################################################################################################################## | ||
# Create source tar for release. Note that it's for OpenWRT package srs-server, so the filename MUST be | ||
# srs-server-xxx.tar.gz, because the package is named srs-server. | ||
# Generate variables like: | ||
# SRS_SOURCE_TAR=srs-player.zip | ||
# SRS_SOURCE_MD5=83e38700a80a26e30b2df054e69956e5 | ||
- name: Create source tar.gz | ||
run: | | ||
DEST_DIR=srs-player && mkdir -p $DEST_DIR && | ||
cp README.md $DEST_DIR && | ||
zip -q -r ${DEST_DIR}.zip ${DEST_DIR} && du -sh ${DEST_DIR}* && | ||
echo "SRS_SOURCE_TAR=${DEST_DIR}.zip" >> $GITHUB_ENV && | ||
echo "SRS_SOURCE_MD5=$(md5sum ${DEST_DIR}.zip| awk '{print $1}')" >> $GITHUB_ENV | ||
# Create release. | ||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body: | | ||
[${{ github.event.head_commit.message }}](https://github.com/ossrs/WordPress-Plugin-SrsPlayer/commit/${{ github.sha }}) | ||
## Resource | ||
* Source: ${{ env.SRS_SOURCE_MD5 }} [${{ env.SRS_SOURCE_TAR }}](https://github.com/ossrs/WordPress-Plugin-SrsPlayer/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_SOURCE_TAR }}) | ||
## Doc | ||
* [Plugin](https://wordpress.org/plugins/srs-player) | ||
* [Features](https://github.com/ossrs/WordPress-Plugin-SrsPlayer/blob/${{ github.sha }}/srs-player/readme.txt) | ||
draft: false | ||
prerelease: true | ||
|
||
# Upload release source files | ||
- name: Upload Release Assets Source | ||
id: upload-release-assets-source | ||
uses: dwenegar/upload-release-assets@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
release_id: ${{ steps.create_release.outputs.id }} | ||
assets_path: ${{ env.SRS_SOURCE_TAR }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
REALPATH=$(realpath $0) | ||
WORK_DIR=$(cd $(dirname $REALPATH)/.. && pwd) | ||
echo "Run pub at $WORK_DIR from $0" | ||
cd $WORK_DIR | ||
|
||
git st |grep -q 'nothing to commit' | ||
if [[ $? -ne 0 ]]; then | ||
echo "Failed: Please commit before release"; | ||
exit 1 | ||
fi | ||
|
||
RELEASE=$(git describe --tags --abbrev=0 --exclude release-*) | ||
REVISION=$(echo $RELEASE|awk -F . '{print $3}') | ||
let NEXT=$REVISION+1 | ||
echo "Last release is $RELEASE, revision is $REVISION, next is $NEXT" | ||
|
||
TAG="v1.0.$NEXT" | ||
echo "publish $TAG" | ||
|
||
git push | ||
git tag -d $TAG 2>/dev/null && git push origin :$TAG | ||
git tag $TAG | ||
git push origin $TAG | ||
echo "publish $TAG ok" | ||
echo " https://github.com/ossrs/WordPress-Plugin-SrsPlayer/tags" |