diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..73b95020 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build + +on: + pull_request: + branches: + - '*' + +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 \ No newline at end of file diff --git a/.github/workflows/develop-release.yml b/.github/workflows/develop-release.yml new file mode 100644 index 00000000..023fb619 --- /dev/null +++ b/.github/workflows/develop-release.yml @@ -0,0 +1,55 @@ +name: Release Candidate + +on: + push: + branches: + - 'develop' + 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}}-rc + release_name: Release Candidate ${{steps.version.outputs.prop}} + draft: false + prerelease: false \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..844c8a78 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,81 @@ +name: Release & Docker + +on: + push: + branches: + - '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: inseefr/pearl-jam + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + tags: ${{steps.version.outputs.prop}} + \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 793a73e8..00000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -language: node_js - -services: - - docker - -sudo: required - -node_js: - - 12.16.1 - -cache: yarn - -script: - - yarn install - - yarn build - - docker build -t inseefr/pearl-jam . - -before_script: - - curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ - -deploy: - - skip_cleanup: true - provider: script - script: - echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin - && docker push inseefr/pearl-jam - on: - branch: master - - - skip_cleanup: true - provider: script - script: - kubectl --token $K8S_TOKEN --server $K8S_SERVER --insecure-skip-tls-verify rollout restart deployment/pearl -n queen - on: - branch: master diff --git a/README.md b/README.md index 1436eb9d..c181371f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/InseeFr/Pearl-Jam.svg?branch=master)](https://travis-ci.org/InseeFr/Pearl-Jam) +![Build](https://github.com/InseeFr/Pearl-Jam/actions/workflows/release.yml/badge.svg) # Pearl Jam