From 25323052d4e2a2817b0f9f48b9856adfc1ad917a Mon Sep 17 00:00:00 2001 From: Maksim Kostromin Date: Tue, 29 Mar 2022 04:02:45 +0300 Subject: [PATCH] Create LICENSE --- .github/workflows/check-versions-updates.yml | 1 - .github/workflows/pre-release.yml | 40 +++++++----- .github/workflows/release.yml | 65 ++++++++++++-------- .github/workflows/tests.yml | 1 - LICENSE.txt | 21 +++++++ README.md | 9 +++ 6 files changed, 96 insertions(+), 41 deletions(-) create mode 100644 LICENSE.txt diff --git a/.github/workflows/check-versions-updates.yml b/.github/workflows/check-versions-updates.yml index cc61a6a..08bc5c9 100644 --- a/.github/workflows/check-versions-updates.yml +++ b/.github/workflows/check-versions-updates.yml @@ -14,7 +14,6 @@ jobs: #manual job definition: if: startsWith(github.event.inputs.trigger, 'm') || startsWith(github.event.inputs.trigger, 'M') - name: updates java-${{ matrix.java }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 1e565b6..8c81b16 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,21 +1,13 @@ name: pre-release on: - workflow_dispatch: - inputs: - trigger: - description: Type m to triggre manual jobs - required: false - default: '' push: branches: [ master, main ] - pull_request: - branches: [ master, main ] + tags-ignore: + - '*' env: JAVA_VERSION: '17' jobs: pre-release: - #if: startsWith(github.event.inputs.trigger, 'm') - # || startsWith(github.event.inputs.trigger, 'M') runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -45,13 +37,31 @@ jobs: # folder: target/generated-docs # The folder the action should deploy. ## Create 'latest' pre-release - run: mkdir -p $GITHUB_WORKSPACE/dist - - run: mv -f $GITHUB_WORKSPACE/build/libs/*.jar $GITHUB_WORKSPACE/dist/gradle-app.jar - - run: mv -f $GITHUB_WORKSPACE/target/*.jar $GITHUB_WORKSPACE/dist/maven-app.jar - - uses: "marvinpinto/action-automatic-releases@latest" + - run: cp -Rfv $GITHUB_WORKSPACE/build/libs/*.jar $GITHUB_WORKSPACE/build/libs/gradle-app.jar + - run: mv -f $GITHUB_WORKSPACE/build/libs/*.jar $GITHUB_WORKSPACE/dist/ + - run: cp -Rfv $GITHUB_WORKSPACE/target/*.jar $GITHUB_WORKSPACE/target/maven-app.jar + - run: cp -Rfv $GITHUB_WORKSPACE/target/*.jar $GITHUB_WORKSPACE/dist/ + - name: Set env variables + id: refs_names + run: | + echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} + echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} + echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + - name: Get env variables + env: + SOURCE_NAME: ${{ steps.refs_names.outputs.SOURCE_NAME }} + SOURCE_BRANCH: ${{ steps.refs_names.outputs.SOURCE_BRANCH }} + SOURCE_TAG: ${{ steps.refs_names.outputs.SOURCE_TAG }} + run: | + echo $SOURCE_NAME + echo $SOURCE_BRANCH + echo $SOURCE_TAG + - uses: 'marvinpinto/action-automatic-releases@latest' with: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: "latest" prerelease: true - title: "Development Build" + title: "Latest ${{ steps.refs_names.outputs.SOURCE_NAME }} build" files: | - dist/*.jar + dist/**/*.jar + LICENSE.txt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fdf5e39..5d4693b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,20 +1,20 @@ name: release on: - workflow_dispatch: - inputs: - trigger: - description: Type m to triggre manual jobs - required: false - default: '' push: tags: - 'v*' +# workflow_dispatch: +# inputs: +# trigger: +# description: Type m to triggre manual jobs +# required: false +# default: '' env: JAVA_VERSION: '17' jobs: release: - if: startsWith(github.event.inputs.trigger, 'm') - || startsWith(github.event.inputs.trigger, 'M') +# if: startsWith(github.event.inputs.trigger, 'm') +# || startsWith(github.event.inputs.trigger, 'M') runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -33,25 +33,42 @@ jobs: - run: cd $GITHUB_WORKSPACE ; ./gradlew --no-daemon --stop - run: cd $GITHUB_WORKSPACE ; ./gradlew --no-daemon --console=plain clean build - run: cd $GITHUB_WORKSPACE ; ./mvnw clean verify - ## TODO: Publish docker images - #- run: cd $GITHUB_WORKSPACE ; docker build --no-cache -t daggerok/file-items-service -f ./linux-services/file-items-service/Dockerfile . - #- run: cd $GITHUB_WORKSPACE ; docker build --no-cache -t daggerok/file-server -f ./linux-services/file-server/Dockerfile . - ## TODO: Publish github release with assets and update back github pages documentation to use jars from github release - #- name: Deploy 🚀 GitHub Pages - # uses: JamesIves/github-pages-deploy-action@4.1.0 - # with: - # branch: gh-pages # The branch the action should deploy to. - # folder: target/generated-docs # The folder the action should deploy. - ## Create 'latest' pre-release +# # TODO: Publish docker images +# - run: cd $GITHUB_WORKSPACE ; docker build --no-cache -t daggerok/file-items-service -f ./linux-services/file-items-service/Dockerfile . +# - run: cd $GITHUB_WORKSPACE ; docker build --no-cache -t daggerok/file-server -f ./linux-services/file-server/Dockerfile . +# # TODO: Publish github release with assets and update back github pages documentation to use jars from github release +# - name: Deploy 🚀 GitHub Pages +# uses: JamesIves/github-pages-deploy-action@4.1.0 +# with: +# branch: gh-pages # The branch the action should deploy to. +# folder: target/generated-docs # The folder the action should deploy. + ## Create 'tagged' pre-release - run: mkdir -p $GITHUB_WORKSPACE/dist - - run: mv -f $GITHUB_WORKSPACE/build/libs/*.jar $GITHUB_WORKSPACE/dist/gradle-app.jar - - run: mv -f $GITHUB_WORKSPACE/target/*.jar $GITHUB_WORKSPACE/dist/maven-app.jar - - uses: "marvinpinto/action-automatic-releases@latest" + - run: cp -Rfv $GITHUB_WORKSPACE/build/libs/*.jar $GITHUB_WORKSPACE/build/libs/gradle-app.jar + - run: mv -f $GITHUB_WORKSPACE/build/libs/*.jar $GITHUB_WORKSPACE/dist/ + - run: cp -Rfv $GITHUB_WORKSPACE/target/*.jar $GITHUB_WORKSPACE/target/maven-app.jar + - run: cp -Rfv $GITHUB_WORKSPACE/target/*.jar $GITHUB_WORKSPACE/dist/ + - name: Set env variables + id: refs_names + run: | + echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} + echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} + echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + - name: Get env variables + env: + SOURCE_NAME: ${{ steps.refs_names.outputs.SOURCE_NAME }} + SOURCE_BRANCH: ${{ steps.refs_names.outputs.SOURCE_BRANCH }} + SOURCE_TAG: ${{ steps.refs_names.outputs.SOURCE_TAG }} + run: | + echo $SOURCE_NAME + echo $SOURCE_BRANCH + echo $SOURCE_TAG + - uses: 'marvinpinto/action-automatic-releases@latest' with: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: "latest" - prerelease: true - title: "Development Build" + prerelease: false + title: "Build ${{ steps.refs_names.outputs.SOURCE_TAG }}" files: | LICENSE.txt - *.jar + dist/*.jar diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f1affdd..f7d5c56 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,6 @@ jobs: if: github.event.inputs.trigger == '' || !startsWith(github.event.inputs.trigger, 'm') || !startsWith(github.event.inputs.trigger, 'M') - name: check java-${{ matrix.java }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..afc0db3 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022-present Maksim Kostromin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index c3cf871..5102835 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,15 @@ # github-action-release-example [![tests](https://github.com/daggerok/github-action-release-example/actions/workflows/tests.yml/badge.svg)](https://github.com/daggerok/github-action-release-example/actions/workflows/tests.yml) [![pre-release](https://github.com/daggerok/github-action-release-example/actions/workflows/pre-release.yml/badge.svg)](https://github.com/daggerok/github-action-release-example/actions/workflows/pre-release.yml) Release apps with github-actions +## on master push re-tag each `master` build and publish `latest` pre-release + +## on any vX.Y.Z tag publish associated release + +```bash +git tag v0.0.1 +git push --tags +``` + ## RTFM * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.5/maven-plugin/reference/html/)