Skip to content

Commit

Permalink
Setup release action (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
svacas authored Oct 28, 2021
1 parent b645643 commit 51e59c2
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# release.yml

changelog:

exclude:
labels:
- ignore-for-release

categories:

- title: New Features
labels:
- enhancement

- title: Bug fixes
labels:
- bug

- title: Other Changes
labels:
- "*"
73 changes: 73 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Mule Migration Assistant Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:

release:

runs-on: ubuntu-latest

steps:

- name: checkout
uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v10
with:
repositories: '[{ "id": "mulesoft-public", "url": "https://repository.mulesoft.org/nexus/content/repositories/public" },
{ "id": "mule-releases", "url": "https://repository.mulesoft.org/releases" }]'

- name: log-settings
run: cat \/home\/runner\/.m2\/settings.xml

- name: Build with Maven
run: mvn --settings /home/runner/.m2/settings.xml clean install --file pom.xml

- name: Guess Release Version
run: |
echo "RELEASE_VERSION=$(echo '${{github.ref}}' | sed -e 's,.*/v\(.*\),\1,')" >> $GITHUB_ENV
#GH RELEASE
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false

- name: Upload Release Asset tgz
id: upload-release-asset-tgz
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: ./runner/target/mule-migration-assistant-runner-${{env.RELEASE_VERSION}}.tar.gz
asset_name: mule-migration-assistant-runner-${{env.RELEASE_VERSION}}.tar.gz
asset_content_type: application/gzip

- name: Upload Release Asset zip
id: upload-release-asset-zip
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: ./runner/target/mule-migration-assistant-runner-${{env.RELEASE_VERSION}}.zip
asset_name: mule-migration-assistant-runner-${{env.RELEASE_VERSION}}.zip
asset_content_type: application/zip
24 changes: 24 additions & 0 deletions update-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

set -e

current=$(cat pom.xml | grep '<version>.*' | head -1 | sed 's/.*<version>\([^<]*\).*/\1/')

if [[ -z $current ]]
then
echo "Current version not found!"
exit 1
fi

read -p "Enter version to update to (current is ${current}): " -r
echo
if [[ $REPLY =~ ^[1-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?$ ]]
then
mvn versions:set -DnewVersion=${REPLY}
pushd target-modules
mvn versions:set -DnewVersion=${REPLY}
popd target-modules
else
echo "Invalid version: $REPLY"
exit 2
fi

0 comments on commit 51e59c2

Please sign in to comment.