name: "release" on: push: branches: - "main" workflow_dispatch: jobs: release: name: "Release" runs-on: "ubuntu-latest" steps: - name: Checkout repository uses: actions/checkout@v2 ### Setup - uses: olafurpg/setup-scala@v10 ### Update & build - name: Assembly run: sbt cli/assembly env: BUILD_NUMBER: ${{ github.run_number }} - name: Get project version # In CI sbt appends a new line after its output, so we need `tail -n3 | head -n2` to get last two non-empty lines run: | # Slower way of getting two variables from sbt. Try it if something breaks # # VERSION="$(sbt 'print cli/version' |& tail -n2 | head -n1)" # BASE_VERSION="$(sbt 'print cli/baseAquaVersion' |& tail -n2 | head -n1)" # print two versions as two lines OUTPUT=$(sbt 'print cli/baseAquaVersion; print cli/version') # read two lines to two variables read -rd "\n" BASE_VERSION VERSION <<<$(echo "$OUTPUT" | tail -n3 | head -n2) || true # debug output echo "BASE_VERSION="$BASE_VERSION echo "VERSION="$VERSION echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV echo "VERSION=$VERSION" >> $GITHUB_ENV env: BUILD_NUMBER: ${{ github.run_number }} - name: Check .jar exists run: | JAR="cli/target/scala-2.13/aqua-cli-${{ env.VERSION }}.jar" stat "$JAR" echo "JAR=$JAR" >> $GITHUB_ENV ### Publish to NPM registry - uses: actions/setup-node@v1 with: node-version: "14" registry-url: "https://registry.npmjs.org" - run: cp ${{ env.JAR }} ./npm/aqua-cli.jar - run: npm version ${{ env.VERSION }} working-directory: ./npm - run: npm publish --access public working-directory: ./npm env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} ### create release - name: Push tag ${{ env.BASE_VERSION }} id: tag_version uses: mathieudutour/github-tag-action@v5.5 with: custom_tag: ${{ env.BASE_VERSION }} tag_prefix: "" github_token: ${{ secrets.PERSONAL_TOKEN }} - name: Build Changelog id: github_release uses: mikepenz/release-changelog-builder-action@v1 with: configuration: ".github/workflows/changelog_config.json" toTag: ${{ steps.tag_version.outputs.new_tag }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Release uses: softprops/action-gh-release@v1 with: name: Aqua Compiler ${{ env.VERSION }} tag_name: ${{ steps.tag_version.outputs.new_tag }} body: ${{ steps.github_release.outputs.changelog }} draft: false prerelease: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}