Skip to content

Commit

Permalink
Ci: upgrade (#709)
Browse files Browse the repository at this point in the history
fix ci
  • Loading branch information
laurentC35 authored Nov 27, 2023
1 parent f4cf8c6 commit 3f513cb
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 83 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Main CI

on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
build:
runs-on: ubuntu-latest
if: github.event.head_commit.author.name != 'github-actions[bot]'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
- run: yarn
- run: yarn build
- uses: actions/upload-artifact@v3
with:
name: pogues
path: build

check_if_version_upgraded:
needs: build
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
outputs:
version: ${{ steps.version.outputs.prop }}
is_version_changed: ${{ steps.check.outputs.exists == 'false' }}
is_pre_release: ${{ contains(steps.version.outputs.prop, '-rc' ) }}
steps:
- uses: actions/checkout@v3
- id: version
uses: notiz-dev/github-action-json-property@release
with:
path: 'package.json'
prop_path: 'version'
## we check if repo contains already this tag, if not version, has changed
- uses: mukunku/[email protected]
id: check
with:
tag: ${{ steps.version.outputs.prop }}

docker_pogues:
needs: check_if_version_upgraded
if: |
(github.event_name == 'push' || needs.check_if_version_upgraded.outputs.is_pre_release == 'true') &&
needs.check_if_version_upgraded.outputs.is_version_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: pogues
path: build
- uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
push: true
tags: |
inseefr/pogues:latest,
inseefr/pogues:${{ needs.check_if_version_upgraded.outputs.version }}
release:
runs-on: ubuntu-latest
needs: check_if_version_upgraded
# We create release only if the version in the package.json have been upgraded and this CI is running against the main branch.
# We allow branches with a PR open on main to publish pre-release (x.y.z-rc.u) but not actual releases.
if: |
(github.event_name == 'push' || needs.check_if_version_upgraded.outputs.is_pre_release == 'true') &&
needs.check_if_version_upgraded.outputs.is_version_changed == 'true'
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: softprops/action-gh-release@v1
with:
name: Release ${{ needs.check_if_version_upgraded.outputs.version }}
tag_name: ${{ needs.check_if_version_upgraded.outputs.version }}
target_commitish: ${{ github.head_ref || github.ref }}
generate_release_notes: true
draft: false
prerelease: ${{ needs.check_if_version_upgraded.outputs.is_pre_release == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 changes: 0 additions & 81 deletions .github/workflows/tag-release.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM nginx
COPY build /usr/share/nginx/html
FROM nginx:1.25.3
ADD build /usr/share/nginx/html
RUN rm etc/nginx/conf.d/default.conf
COPY nginx.conf etc/nginx/conf.d/

Expand Down

0 comments on commit 3f513cb

Please sign in to comment.