Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup release action #555

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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