From 4094f3867aed8594da51d320845856605072feab Mon Sep 17 00:00:00 2001 From: AlexisG Date: Tue, 15 Oct 2024 16:38:58 +0200 Subject: [PATCH] chore: Add CI with Github Actions And remove Travis --- .github/workflows/ci-cd.yml | 45 ++++++++++++++++++++++++++++++++++ .travis.yml | 49 ------------------------------------- id_rsa_downcloud_photos.enc | 2 -- package.json | 2 +- 4 files changed, 46 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/ci-cd.yml delete mode 100644 .travis.yml delete mode 100644 id_rsa_downcloud_photos.enc diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 000000000..0237305e5 --- /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":"app-photos","beta":"app-photos,publication","stable":"app-photos,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 5d55b9ccc..000000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -language: node_js -node_js: 20 -dist: jammy -cache: yarn -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":"app-photos","beta":"app-photos,publication","stable":"app-photos,publication"}' - # MATERMOST_HOOK_URL for post on mattermost - - secure: "n2woUawe27+dU7pRl5aM3lTHpEKoLMpFNXBJPOVeBV/lNl+I0HDYMPJGNRBZKeYRvCBimHKiq2lcNnKLAG9FOeVfDdoxLDeLbIOT4h+PphN1Z0NdIRav4q9HEz1L044+bfF9jYVWizBNTMxpDv74i43qge6eh+BJp8OynVEtrH23XczE2qBgWqcoZSN3zQFJDq5e7s5Rk0x1pl7hqvutoWXT41gP021mCSj7sqVlEj0LG0wESFMz13ja74PbNHJTLYiK0oKpmsnrUabPJxWaNyNbfe4wYCB4ctniMXvpF6Yy79bvmkqpbWiNo7+9pphlo0xlBB0s2/g/diWVEOV+ia+ctfcl8JQizt4pCCWE3rkboYSOMVkVWiBy9OC6KghG0hhevYkLIihRuBaD7m8piaJ/XPwrX5rVdF/oE2CllpuHNdccxaLs8QXataCZZEsYfdE+9A1wLamrqJi3G4rhcI3cHIT4d15mnEySK/Vzhvy1dlpkUxUQJreuKxMqZ95BsRK6nnS97Cqxlvw4QfIszJ4cIwvbPukaeMhymYOdfo1YgTcMpFNsoP7HjBNGgHWPxG0WYt35cs3lU66nsY/hTpD8P0ymzWVFrb/DQMcliJWh0+CRx/e1PIAgYju7x7m2cXXamMx3Pvkr9+HqYCZ5OLn8GcxE7nLcVjHKic3Vv+c=" - # REGISTRY_TOKEN for yarn cozyPublish script - - secure: "U6H8M/733c/b0z9q6wMdX7XdkS4PTrqKg1byN7tkowsmbJ+SNv8MI4K/l8fPzJuy5gl0nBe02X69+y3j6Cm5NajzarDt0E7QtlfdR6YfRowCjt2n3sYLak9F2cPdDw1H29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xHxMapACFR4jnFAR9kYUtP1sQbdO/MyhBf9bmHiqRiAjjHOiKLBIvHTM/BrR3kO6fv1xTx6INYyfJSwg5uhqdyGPFlNaWG5CiEJx80giP3n7hIjQ3kVpwx5Dh02bmhZ3I6GMUo/OkFM11FBnx84RgRG/tt3VVIpmQsuYjQBZ/Rzs3UBZQo=" -jobs: - include: - - name: 'Lint' - script: yarn lint - - name: 'Test' - script: yarn test - - name: 'Build app' - before_script: - - '[ "$TRAVIS_SECURE_ENV_VARS" != "false" ] && openssl aes-256-cbc -K $encrypted_497d1a9dc404_key -iv $encrypted_497d1a9dc404_iv -in id_rsa_downcloud_photos.enc -out id_rsa_downcloud_photos -d' - - '[ "$TRAVIS_SECURE_ENV_VARS" != "false" ] && eval "$(ssh-agent -s)"' - - '[ "$TRAVIS_SECURE_ENV_VARS" != "false" ] && chmod 600 id_rsa_downcloud_photos' - - '[ "$TRAVIS_SECURE_ENV_VARS" != "false" ] && ssh-add id_rsa_downcloud_photos' - script: - - yarn build - before_deploy: - - yarn add cozy-app-publish # to be sure to have the last version before deploy - deploy: - - provider: script - repo: cozy/cozy-photos - skip_cleanup: true - script: yarn run deploy - on: - # deploy the build on a build branch and publish to the Cozy registry - branch: master - - provider: script - repo: cozy/cozy-photos - skip_cleanup: true - script: yarn run deploy - on: - # publish stable or beta versions using Github Releases (git tag) - tags: true diff --git a/id_rsa_downcloud_photos.enc b/id_rsa_downcloud_photos.enc deleted file mode 100644 index 9dfae3a09..000000000 --- a/id_rsa_downcloud_photos.enc +++ /dev/null @@ -1,2 +0,0 @@ -&;|7D}ū/Uslinv<!)lFPBH{\t2FwM˺RҢ.ҧOpm -ZBYݩpgt$B~끸b(P|i ?qVK:G ^jq%~ :%v͖>|'4!!}}VXzճ"BU7ў