Skip to content

Commit

Permalink
feat: github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Nsenz committed Feb 8, 2022
1 parent 6088ad3 commit 76677dc
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 7 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Artifact

on:
workflow_dispatch:
pull_request:
types: [opened, reopened]
branches: [master]

jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Get Info
run: |
echo "::set-output name=id::$(jq -r '.id' module.json)"
id: info
- name: Build Artifact
run: |
cd ${{ github.workspace }}
chmod +x ./pack.sh
./pack.sh
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.info.outputs.id }}
path: deploy
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release

on:
push:
branches: [master]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Install Zip
run: sudo apt-get install zip
- name: Get Info
run: |
echo "::set-output name=version::$(jq -r '.version' module.json)"
echo "::set-output name=id::$(jq -r '.id' module.json)"
id: info
- name: Build Artifact
run: |
cd ${{ github.workspace }}
chmod +x ./pack.sh
./pack.sh
mv deploy/onlyoffice ${{ github.workspace }}/onlyoffice
- name: Pack Artifact
run: zip -r ${{ steps.info.outputs.id }}.zip onlyoffice
- name: Release Artifact
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: v${{ steps.info.outputs.version }}
tag_name: v${{ steps.info.outputs.version }}
body_path: ./RELEASE.md
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.info.outputs.id }}.zip
asset_name: ${{ steps.info.outputs.id }}.zip
asset_content_type: application/zip
17 changes: 10 additions & 7 deletions pack.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#!/bin/bash

rm -rf ./deploy
rm -rf /tmp/humhub-deploy/
rm ./RELEASE.md

cwd=$(pwd)
git submodule update --init --recursive

cp -r ./ /tmp/humhub-deploy/
mkdir -p ./deploy/onlyoffice
cd /tmp/humhub-deploy/
rsync -av --exclude='deploy' ./ ./deploy/onlyoffice
cd ./deploy/onlyoffice

rm -rf ./.github
rm -rf ./.git/
rm -rf ./resources/templates/.git/
rm ./.gitignore
rm .gitignore
rm .gitmodules
rm -rf ./resources/templates/.git
rm ./pack.sh

mkdir docs
Expand All @@ -24,4 +26,5 @@ node pack.js
rm ./pack.js
rm ./README.md

mv ./* $cwd/deploy/onlyoffice/
cd $cwd
awk '/## [0-9]/{p++} p; /## [0-9]/{if (p > 1) exit}' CHANGELOG.md | awk 'NR>2 {print last} {last=$0}' > RELEASE.md

0 comments on commit 76677dc

Please sign in to comment.