-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
73 additions
and
8 deletions.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Release plugin | ||
name: Release | ||
|
||
on: | ||
push: | ||
|
@@ -9,11 +9,66 @@ env: | |
PLUGIN_NAME: oencrypt | ||
|
||
jobs: | ||
update_version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Update versions.json | ||
run: | | ||
TAG_NAME=${{ github.ref }} | ||
TAG_NAME=${TAG_NAME#refs/tags/} | ||
if ! grep -q "\"$TAG_NAME\":" versions.json; then | ||
LAST_VERSION=$(jq 'keys | .[-1]' versions.json) | ||
jq --arg tag "$TAG_NAME" --arg last "$LAST_VERSION" '.[$tag] = $last' versions.json > tmp.json && mv tmp.json versions.json | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add versions.json | ||
git commit -m "Update versions.json for $TAG_NAME" | ||
fi | ||
- name: Update package.json | ||
run: | | ||
TAG_NAME=${{ github.ref }} | ||
TAG_NAME=${TAG_NAME#refs/tags/} | ||
CURRENT_VERSION=$(jq -r '.version' package.json) | ||
if [ "$CURRENT_VERSION" != "$TAG_NAME" ]; then | ||
jq --arg tag "$TAG_NAME" '.version = $tag' package.json > tmp.json && mv tmp.json package.json | ||
git add package.json | ||
git commit -m "Update package.json version to $TAG_NAME" | ||
fi | ||
- name: Update manifest.json | ||
run: | | ||
TAG_NAME=${{ github.ref }} | ||
TAG_NAME=${TAG_NAME#refs/tags/} | ||
CURRENT_VERSION=$(jq -r '.version' manifest.json) | ||
if [ "$CURRENT_VERSION" != "$TAG_NAME" ]; then | ||
jq --arg tag "$TAG_NAME" '.version = $tag' manifest.json > tmp.json && mv tmp.json manifest.json | ||
git add manifest.json | ||
git commit -m "Update manifest.json version to $TAG_NAME" | ||
fi | ||
- name: Push changes | ||
run: | | ||
git push origin HEAD:master | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: update_version | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
|
@@ -28,6 +83,7 @@ jobs: | |
mkdir dist | ||
cp ./main.js ./manifest.json dist | ||
cp ./main.js ./manifest.json ${{ env.PLUGIN_NAME }} | ||
cp ./assets/styles.css ./assets/styles.css ${{ env.PLUGIN_NAME }} | ||
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }} | ||
ls | ||
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)" | ||
|
@@ -66,7 +122,7 @@ jobs: | |
asset_name: main.js | ||
asset_content_type: text/javascript | ||
|
||
- name: Upload custom.css | ||
- name: Upload styles.css | ||
id: upload-css | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
|
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"1.0.0": "0.15.0" | ||
"1.0.0": "0.15.0", | ||
"1.0.1": "0.15.0" | ||
} |