diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..3df7a0fc4a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,151 @@ +# This is a basic workflow that is manually triggered + +name: Release Workflow + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch to use to do the release e.g. 2022.02.xx (YYYY.XX.xx)' + required: true + version: + description: 'Version to release, e.g. 2022.02.01. (YYYY.XX.mm)' + required: true + previousVersion: + description: 'Previous release version number (needed to generate proper changelog e.g. 2022.02.00) (YYYY.XX.mm)' + required: true + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "greet" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + steps: + - name: "checking out" + uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.branch }} + - name: "setting up npm" + uses: actions/setup-node@v2 + with: + node-version: '12.x' + - name: "setting up Java" + uses: actions/setup-java@v1 + with: + java-version: '8.x' + ############ + # CACHING + ########## + - name: "cache node modules" + uses: actions/cache@v1 + env: + cache-name: cache-node-modules + with: + path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: "cache maven dependencies" + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: mapstore-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + mapstore-${{ runner.os }}-maven- + ############ + # Build + ########## + - name: Build + id: "build" + run: "./build.sh ${{ github.event.inputs.version }} binary,printingbundle" + - name: "Upload war" + uses: actions/upload-artifact@v3 + with: + name: war + path: product/target/mapstore.war + - name: "Upload binary" + uses: actions/upload-artifact@v3 + with: + name: binary + path: "binary/target/mapstore2-${{ github.event.inputs.version }}-bin.zip" + - name: "Upload printing" + uses: actions/upload-artifact@v3 + with: + name: printing + path: "java/printing/target/mapstore-printing.zip" + release: + runs-on: ubuntu-latest + needs: build + steps: + - name: "Download war" + uses: actions/download-artifact@v3 + with: + path: artifacts/ + - name: Display structure of downloaded files + run: ls -R + working-directory: artifacts + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: create_release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + commitish: ${{ github.event.inputs.branch }} + tag_name: "v${{ github.event.inputs.version }}" + release_name: "v${{ github.event.inputs.version }}" + body: | + ## Useful links related to [v${{ github.event.inputs.version }}](https://github.com/geosolutions-it/MapStore2/tree/v${{ github.event.inputs.version }}) + + - [Full Changelog](