From 3c0895533c0d8d1f014504c7846910942dcb3b7b Mon Sep 17 00:00:00 2001 From: Nikolas Eller Date: Mon, 17 Feb 2020 08:54:14 +0100 Subject: [PATCH] #35: Adds continuous delivery to Github Release (#36) --- .github/workflows/ci.yml | 19 --------- .github/workflows/ci_and_cd.yml | 75 +++++++++++++++++++++++++++++++++ extension/description.xml | 37 +++++++--------- increase-version.sh | 10 +++++ 4 files changed, 101 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/ci_and_cd.yml create mode 100755 increase-version.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 4e4a7d5..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: CI - -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 \ No newline at end of file diff --git a/.github/workflows/ci_and_cd.yml b/.github/workflows/ci_and_cd.yml new file mode 100644 index 0000000..8564950 --- /dev/null +++ b/.github/workflows/ci_and_cd.yml @@ -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 "versionbot@expandanimations.local" + 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 }} \ No newline at end of file diff --git a/extension/description.xml b/extension/description.xml index 506cf04..6888798 100644 --- a/extension/description.xml +++ b/extension/description.xml @@ -1,21 +1,16 @@ - - - - - - - - - - - - - - Expand Animations - - + + + + + + + + + + + + Expand Animations + + diff --git a/increase-version.sh b/increase-version.sh new file mode 100755 index 0000000..2e4f63a --- /dev/null +++ b/increase-version.sh @@ -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 \ No newline at end of file