release #369
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
workflow_dispatch: | |
jobs: | |
upgrade-version: | |
runs-on: ubuntu-20.04 | |
outputs: | |
new_tag: ${{ steps.version.outputs.new_tag }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: '0' | |
- name: Compute the new version number | |
id: version | |
uses: anothrNick/github-tag-action@1.36.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: patch | |
RELEASE_BRANCHES: 'develop' | |
DRY_RUN: true | |
WITH_V: false | |
- name: Update version in api package.json | |
uses: jossef/action-set-json-field@v1 | |
with: | |
file: packages/api/package.json | |
field: version | |
value: ${{ steps.version.outputs.new_tag }} | |
- name: Update version in webapp package.json | |
uses: jossef/action-set-json-field@v1 | |
with: | |
file: packages/frontend/webapp/package.json | |
field: version | |
value: ${{ steps.version.outputs.new_tag }} | |
- name: Update version in www package.json | |
uses: jossef/action-set-json-field@v1 | |
with: | |
file: packages/frontend/www/package.json | |
field: version | |
value: ${{ steps.version.outputs.new_tag }} | |
- name: Update version in root package.json | |
uses: jossef/action-set-json-field@v1 | |
with: | |
file: package.json | |
field: version | |
value: ${{ steps.version.outputs.new_tag }} | |
- name: Commit change in package.json | |
run: | | |
git config --local user.email "admin@resorption-bidonvilles.beta.gouv.fr" | |
git config --local user.name "GitHub Action" | |
git commit -m "📦 Release v${{ steps.version.outputs.new_tag }}" -a | |
git tag v${{ steps.version.outputs.new_tag }} | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
tags: true | |
- name: Merge develop into master | |
uses: devmasx/merge-branch@v1.3.1 | |
with: | |
github_token: ${{ github.token }} | |
type: now | |
from_branch: develop | |
target_branch: master | |
build-www: | |
needs: upgrade-version | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: 'master' | |
fetch-depth: '0' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-www-buildx-v${{ needs['upgrade-version'].outputs.new_tag }} | |
restore-keys: | | |
${{ runner.os }}-www-buildx | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: Dockerfile.www | |
push: true | |
tags: resorptionbidonvilles/www:v${{ needs['upgrade-version'].outputs.new_tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
build-webapp: | |
needs: upgrade-version | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: 'master' | |
fetch-depth: '0' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-webapp-buildx-v${{ needs['upgrade-version'].outputs.new_tag }} | |
restore-keys: | | |
${{ runner.os }}-webapp-buildx | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: Dockerfile.webapp | |
push: true | |
tags: resorptionbidonvilles/frontend:v${{ needs['upgrade-version'].outputs.new_tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
build-api: | |
needs: upgrade-version | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: 'master' | |
fetch-depth: '0' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-api-buildx-v${{ needs['upgrade-version'].outputs.new_tag }} | |
restore-keys: | | |
${{ runner.os }}-api-buildx | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: Dockerfile.api | |
push: true | |
tags: resorptionbidonvilles/api:v${{ needs['upgrade-version'].outputs.new_tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |