diff --git a/.github/workflows/create-release-v2-develop-publish-docker.yaml b/.github/workflows/create-release-v2-develop-publish-docker.yaml new file mode 100644 index 00000000..a3d30cc7 --- /dev/null +++ b/.github/workflows/create-release-v2-develop-publish-docker.yaml @@ -0,0 +1,128 @@ +name: Create tag with -rc for develop without release note + +on: + push: + branches: + - v2-develop + +jobs: + install: + runs-on: ubuntu-latest + steps: + - name: Use Node.js 16 + uses: actions/setup-node@v3 + with: + node-version: 16 + - run: yarn --frozen-lockfile + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js 16 + uses: actions/setup-node@v3 + with: + node-version: 16 + - run: yarn + - run: yarn build + - name: Upload build + uses: actions/upload-artifact@v3 + with: + name: build + path: build + + check-version: + needs: [install, build] + runs-on: ubuntu-latest + outputs: + release-version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get version + id: version + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + + - name: Print version + run: echo ${{ steps.version.outputs.version }} + + - uses: mukunku/tag-exists-action@v1.2.0 + name: Check tag existence + id: check-tag-exists + with: + tag: ${{ steps.version.outputs.version }}-rc + + - if: ${{ steps.check-tag-exists.outputs.exists == 'false' }} + name: Check tag format + id: check-tag-format + run: | + if ! [[ "${{ steps.version.outputs.version }}" =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then + echo "is-tag-format-correct=false" >> $GITHUB_OUTPUT + fi + + - name: Tag verification + id: check-tag + run: | + if [[ "${{ steps.check-tag-exists.outputs.exists }}" == "true" ]]; then + echo "Nothing to tag/release, the tag ${{ steps.version.outputs.version }}-rc already exists" + exit 1 + fi + + if ! [[ "${{ steps.version.outputs.version }}" =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then + echo "Nothing to tag/release, the tag ${{ steps.version.outputs.version }}-rc is not in correct format X.Y.Z" + exit 1 + fi + + create-release: + needs: check-version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.ref }} + fetch-depth: 0 + + - name: Get previous final release tag + id: previousTag + run: | + previousTag=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$" | tail -1) + if [ -z "$previousTag" ]; then + echo "previousTag=$(git rev-list --max-parents=0 HEAD)" >> $GITHUB_OUTPUT + else + echo "previousTag=$previousTag" >> $GITHUB_OUTPUT + fi + + - uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ needs.check-version.outputs.release-version }}-rc + target_commitish: ${{ github.head_ref || github.ref }} + name: ${{ needs.check-version.outputs.release-version }}-rc + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + docker: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Download build + id: download + uses: actions/download-artifact@v3 + with: + name: build + path: build + - name: Get current version + id: version + uses: notiz-dev/github-action-json-property@release + with: + path: 'package.json' + prop_path: 'version' + - run: echo ${{steps.version.outputs.prop}} + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: ${{ secrets.DOCKERHUB_REGISTRY_HOST }}/stromae + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + tags: ${{steps.version.outputs.prop}} diff --git a/.github/workflows/create-release-v2-master-publish-docker.yml b/.github/workflows/create-release-v2-master-publish-docker.yml new file mode 100644 index 00000000..ba96cb3e --- /dev/null +++ b/.github/workflows/create-release-v2-master-publish-docker.yml @@ -0,0 +1,129 @@ +name: Create release & Docker build v2-master + +on: + push: + branches: + - v2-master + +jobs: + check-version: + runs-on: ubuntu-latest + outputs: + release-version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get version + id: version + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + + - name: Print version + run: echo ${{ steps.version.outputs.version }} + + - uses: mukunku/tag-exists-action@v1.2.0 + name: Check tag existence + id: check-tag-exists + with: + tag: ${{ steps.version.outputs.version }} + + - if: ${{ steps.check-tag-exists.outputs.exists == 'false' }} + name: Check tag format + id: check-tag-format + run: | + if ! [[ "${{ steps.version.outputs.version }}" =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then + echo "is-tag-format-correct=false" >> $GITHUB_OUTPUT + fi + + - name: Tag verification + id: check-tag + run: | + if [[ "${{ steps.check-tag-exists.outputs.exists }}" == "true" ]]; then + echo "Nothing to tag/release, the tag ${{ steps.version.outputs.version }} already exists" + exit 1 + fi + + if ! [[ "${{ steps.version.outputs.version }}" =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then + echo "Nothing to tag/release, the tag ${{ steps.version.outputs.version }} is not in correct format X.Y.Z" + exit 1 + fi + + build: + needs: check-version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js 16 + uses: actions/setup-node@v3 + with: + node-version: 16 + - run: yarn + - run: yarn build + - name: Upload build + uses: actions/upload-artifact@v3 + with: + name: build + path: build + + create-release: + needs: [check-version, build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.ref }} + fetch-depth: 0 + + - name: Get previous final release tag + id: previousTag + run: | + previousTag=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$" | tail -1) + if [ -z "$previousTag" ]; then + echo "previousTag=$(git rev-list --max-parents=0 HEAD)" >> $GITHUB_OUTPUT + else + echo "previousTag=$previousTag" >> $GITHUB_OUTPUT + fi + + - name: Create release note + id: changelog + uses: requarks/changelog-action@v1 + with: + fromTag: ${{ github.sha }} + toTag: ${{ steps.previousTag.outputs.previousTag}} + token: ${{ secrets.GITHUB_TOKEN }} + writeToFile: false + + - uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ needs.check-version.outputs.release-version }} + target_commitish: ${{ github.head_ref || github.ref }} + name: ${{ needs.check-version.outputs.release-version }} + body: ${{steps.changelog.outputs.changes}} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + docker: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Download build + id: download + uses: actions/download-artifact@v3 + with: + name: build + path: build + - name: Get current version + id: version + uses: notiz-dev/github-action-json-property@release + with: + path: 'package.json' + prop_path: 'version' + - run: echo ${{steps.version.outputs.prop}} + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: ${{ secrets.DOCKERHUB_REGISTRY_HOST }}/stromae + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + tags: ${{steps.version.outputs.prop}} diff --git a/.github/workflows/develop-release.yml b/.github/workflows/develop-release.yml deleted file mode 100644 index baa181cf..00000000 --- a/.github/workflows/develop-release.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Release Candidate - -on: - push: - branches: - - 'v2-develop' - tags: - - '*' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14 - uses: actions/setup-node@v1 - with: - node-version: 14 - - run: yarn - - run: yarn build - - name: Upload build - uses: actions/upload-artifact@v2 - with: - name: build - path: build - release: - runs-on: ubuntu-latest - steps: - - name: Checkout current branch - uses: actions/checkout@v2 - - name: Get current version - id: version - uses: notiz-dev/github-action-json-property@release - with: - path: 'package.json' - prop_path: 'version' - - run: echo ${{steps.version.outputs.prop}} - - name: Release snapshot - id: release-snapshot - uses: actions/create-release@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{steps.version.outputs.prop}}-rc - release_name: Release Candidate ${{steps.version.outputs.prop}} - draft: false - prerelease: false - docker: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Download build - id: download - uses: actions/download-artifact@v2 - with: - name: build - path: build - - name: Get current version - id: version - uses: notiz-dev/github-action-json-property@release - with: - path: 'package.json' - prop_path: 'version' - - run: echo ${{steps.version.outputs.prop}} - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: ${{ secrets.DOCKERHUB_REGISTRY_HOST }}/stromae - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - tags: ${{steps.version.outputs.prop}}-rc diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c674068d..7bf9c5ce 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,15 +11,15 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14 - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - name: Use Node.js 16 + uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 16 - run: yarn - run: yarn build - name: Upload build - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: build path: build @@ -27,10 +27,10 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download build id: download - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build path: build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 18a6e069..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Release & Docker - -on: - push: - branches: - - 'v2-master' - tags: - - '*' - -jobs: - install: - runs-on: ubuntu-latest - steps: - - name: Use Node.js 14C - uses: actions/setup-node@v1 - with: - node-version: 14 - - run: yarn --frozen-lockfile - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14 - uses: actions/setup-node@v1 - with: - node-version: 14 - - run: yarn - - run: yarn build - - name: Upload build - uses: actions/upload-artifact@v2 - with: - name: build - path: build - release: - runs-on: ubuntu-latest - steps: - - name: Checkout current branch - uses: actions/checkout@v2 - - name: Get current version - id: version - uses: notiz-dev/github-action-json-property@release - with: - path: 'package.json' - prop_path: 'version' - - run: echo ${{steps.version.outputs.prop}} - - name: Release snapshot - id: release-snapshot - uses: actions/create-release@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{steps.version.outputs.prop}} - release_name: ${{steps.version.outputs.prop}} - draft: false - prerelease: false - docker: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Download build - id: download - uses: actions/download-artifact@v2 - with: - name: build - path: build - - name: Get current version - id: version - uses: notiz-dev/github-action-json-property@release - with: - path: 'package.json' - prop_path: 'version' - - run: echo ${{steps.version.outputs.prop}} - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: ${{ secrets.DOCKERHUB_REGISTRY_HOST }}/stromae - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - tags: ${{steps.version.outputs.prop}} diff --git a/package.json b/package.json index a7bb87f5..c792325c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stromae", - "version": "2.4.9", + "version": "2.4.14", "description": "Web application for the management of questionnaires powered by Lunatic", "repository": { "type": "git",