Skip to content

Commit b57d958

Browse files
committed
Add generate-package.yml and update version.xml
1 parent 81c849e commit b57d958

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: Create release and tar.gz package for it
7+
8+
jobs:
9+
create-release:
10+
name: Create release and package
11+
env:
12+
PLUGIN_NAME: dataverse
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
- name: Check version.xml
18+
run: |
19+
sudo apt install xmlstarlet
20+
application=$(xmlstarlet sel -t -v 'version/application' version.xml)
21+
if [ $application != $PLUGIN_NAME ]; then exit 1; fi
22+
release=$(xmlstarlet sel -t -v 'version/release' version.xml)
23+
tag=${{ github.ref }}
24+
tag=${tag/refs\/tags\/v}
25+
if [[ $release != $tag* ]]; then exit 1; fi
26+
date_version=$(xmlstarlet sel -t -v 'version/date' version.xml)
27+
current_date=$(date +'%Y-%m-%d')
28+
if [ $date_version != $current_date ]; then exit 1; fi
29+
shell: bash
30+
- name: Create the tar.gz package
31+
run: |
32+
mkdir $PLUGIN_NAME
33+
shopt -s extglob
34+
cp -r !($PLUGIN_NAME|.git*|.|..|tests) $PLUGIN_NAME
35+
tar -zcvf $PLUGIN_NAME.tar.gz $PLUGIN_NAME
36+
shell: bash
37+
- name: Create the release
38+
id: create_release
39+
uses: actions/create-release@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
tag_name: ${{ github.ref }}
44+
release_name: Release ${{ github.ref }}
45+
draft: false
46+
prerelease: false
47+
- name: Upload the package as release asset
48+
id: upload-release-asset
49+
uses: actions/upload-release-asset@v1
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
with:
53+
upload_url: ${{ steps.create_release.outputs.upload_url }}
54+
asset_path: ./${{ env.PLUGIN_NAME }}.tar.gz
55+
asset_name: ${{ env.PLUGIN_NAME }}.tar.gz
56+
asset_content_type: application/x-compressed-tar

version.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<version>
1414
<application>dataverse</application>
1515
<type>plugins.generic</type>
16-
<release>1.2.0.0</release>
17-
<date>2022-01-12</date>
16+
<release>1.3.0.0</release>
17+
<date>2022-01-13</date>
1818
<lazy-load>1</lazy-load>
1919
<class>DataversePlugin</class>
2020
</version>

0 commit comments

Comments
 (0)