Skip to content

Commit f6c5109

Browse files
committed
Adds github workflow script.
issue: documentacao-e-tarefas/desenvolvimento_e_infra#646 Signed-off-by: iudi <iudi@lepidus.com.br> Signed-off-by: jhon <jhon@lepidus.com.br>
1 parent 162084a commit f6c5109

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)