diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 00000000..1345b3a4 --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,45 @@ +name: CI/CD + +on: + pull_request: + push: + branches: + - master + tags: + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + +env: + MATTERMOST_CHANNEL: '{"dev":"projet---la-rochelle","beta":"projet---la-rochelle,publication","stable":"projet---la-rochelle,publication"}' + MATTERMOST_HOOK_URL: ${{ secrets.MATTERMOST_HOOK_URL }} + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + BUNDLEMON_PROJECT_ID: ${{ secrets.BUNDLEMON_PROJECT_ID }} + +jobs: + build: + name: Build and publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Lint + run: yarn lint + - name: Test + run: yarn test + - name: Build + run: yarn build + - name: BundleMon + uses: lironer/bundlemon-action@v1 + - name: Set SSH for downcloud + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.DOWNCLOUD_SSH_KEY }} + - name: Publish + if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') + run: yarn run cozyPublish --yes diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ee3580b7..00000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -language: node_js -dist: jammy -cache: - npm: false -branches: - only: - - master - # detect also tag like x.y.z or x.y.z-beta.n as travis consider them to be branches - - /^\d+\.\d+\.\d+(\-beta.\d+)?$/ - -env: - global: - - MATTERMOST_CHANNEL='{"dev":"projet---la-rochelle","beta":"projet---la-rochelle,publication","stable":"projet---la-rochelle,publication"}' - # GITHUB_TOKEN for yarn deploy script - # to generate yours : travis encrypt GITHUB_TOKEN= -r cozy/coachCO2 - # REGISTRY_TOKEN for yarn cozyPublish script - # to generate yours : travis encrypt REGISTRY_TOKEN= -r cozy/coachCO2 - # N.B.: the --org option is needed only for public repositories -jobs: - include: - - name: 'Lint' - script: yarn lint - - name: 'Unit tests' - script: yarn test - - name: 'Build app' - script: - - yarn build - - yarn bundlemon - before_install: - - '[ "$TRAVIS_SECURE_ENV_VARS" != "false" ] && openssl aes-256-cbc -K $encrypted_d66f6ce0658a_key -iv $encrypted_d66f6ce0658a_iv -in id_rsa_downcloud_coachCO2.enc -out id_rsa_downcloud_coachCO2 -d' - - '[ "$TRAVIS_SECURE_ENV_VARS" != "false" ] && eval "$(ssh-agent -s)"' - - '[ "$TRAVIS_SECURE_ENV_VARS" != "false" ] && chmod 600 id_rsa_downcloud_coachCO2' - - '[ "$TRAVIS_SECURE_ENV_VARS" != "false" ] && ssh-add id_rsa_downcloud_coachCO2' - before_deploy: - - yarn add cozy-app-publish # to be sure to have the last version before deploy - deploy: - - provider: script - repo: cozy/coachCO2 - skip-cleanup: true - # deploy the build on a build branch and publish to the Cozy registry - script: yarn cozyPublish - on: - branch: master - - provider: script - repo: cozy/coachCO2 - skip-cleanup: true - # publish stable or beta versions using Github Releases (git tag) - script: yarn cozyPublish - on: - tags: true diff --git a/id_rsa_downcloud_coachCO2.enc b/id_rsa_downcloud_coachCO2.enc deleted file mode 100644 index 41eca758..00000000 Binary files a/id_rsa_downcloud_coachCO2.enc and /dev/null differ