Skip to content

Commit

Permalink
#35: Adds continuous delivery to Github Release (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolasel authored Feb 17, 2020
1 parent 345d5c3 commit 3c08955
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 40 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/ci.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/ci_and_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CI and CD

on: [push, pull_request]

jobs:
ci:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Install LibreOffice
run: sudo apt-get install libreoffice-impress xmlstarlet poppler-utils
- name: Build Extension
run: make
- name: Install Extension
run: make install
- name: Test Extension
run: make test


cd:
if: github.event_name == 'push' && endsWith(github.ref, '/master')

needs: ci

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Install Dependencies
run: sudo apt-get install xmlstarlet
- name: Build Extension
run: make
- name: Set Version
run: |
version=`xmlstarlet sel -N oo="http://openoffice.org/extensions/description/2006" -t -v "//oo:version/@value" extension/description.xml`
echo ::set-env name=VERSION::$version
- name: Create GitHub Releases
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
# Uncomment if some release notes are available
#body: |
# Changes in this Release
# - First Change
# - Second Change
draft: false
prerelease: false
- name: Post Extension to GitHub Releases
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./dist/ExpandAnimations-${{ env.VERSION }}.oxt
asset_name: ExpandAnimations-${{ env.VERSION }}.oxt
asset_content_type: application/zip
- name: Increase Version
run: ./increase-version.sh
- name: Commit Git Changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "Version Bot"
git add extension/description.xml
git commit -m "Extension version updated"
- name: Push Git Changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
37 changes: 16 additions & 21 deletions extension/description.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
<?xml version='1.0' encoding='UTF-8'?>
<description
xmlns="http://openoffice.org/extensions/description/2006"
xmlns:dep="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="vnd.basicaddonbuilder.expandanimations"/>

<version value="0.7-Snapshot"/>
<!-- <dependencies>
<OpenOffice.org-minimal-version value="2.1" dep:name="OpenOffice.org 2.1"/>
</dependencies> -->
<registration>
<simple-license accept-by="admin" default-license-id="ID0" suppress-on-update="true" >
<license-text xlink:href="registration/lgpl-3.0.txt" lang="en" license-id="ID0" />
</simple-license>
</registration>

<display-name>
<name lang="en">Expand Animations</name>
</display-name>
</description>
<?xml version="1.0" encoding="UTF-8"?>
<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:dep="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="vnd.basicaddonbuilder.expandanimations"/>
<version value="0.7"/>
<!-- <dependencies>
<OpenOffice.org-minimal-version value="2.1" dep:name="OpenOffice.org 2.1"/>
</dependencies> -->
<registration>
<simple-license accept-by="admin" default-license-id="ID0" suppress-on-update="true">
<license-text xlink:href="registration/lgpl-3.0.txt" lang="en" license-id="ID0"/>
</simple-license>
</registration>
<display-name>
<name lang="en">Expand Animations</name>
</display-name>
</description>
10 changes: 10 additions & 0 deletions increase-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e
CURRENT_VERSION=`xmlstarlet sel -N oo="http://openoffice.org/extensions/description/2006" -t -v "//oo:version/@value" extension/description.xml`
MAJOR_VERSION=${CURRENT_VERSION%.*}
MINOR_VERSION=${CURRENT_VERSION#*.}
NEW_VERSION=$MAJOR_VERSION'.'$(($MINOR_VERSION+1))
echo "Current major version: "$MAJOR_VERSION
echo "Current minor version: "$MINOR_VERSION
echo "New version: "$NEW_VERSION
xmlstarlet ed --inplace -N oo="http://openoffice.org/extensions/description/2006" -u "//oo:version/@value" -v $NEW_VERSION extension/description.xml

0 comments on commit 3c08955

Please sign in to comment.