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

V2 test develop ci #344

Open
wants to merge 12 commits into
base: v2-develop
Choose a base branch
from
Open
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
128 changes: 128 additions & 0 deletions .github/workflows/create-release-v2-develop-publish-docker.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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}}
129 changes: 129 additions & 0 deletions .github/workflows/create-release-v2-master-publish-docker.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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}}
72 changes: 0 additions & 72 deletions .github/workflows/develop-release.yml

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ 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
docker:
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
Expand Down
Loading