diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..b729f1977 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,16 @@ +name: CI + +on: + push: + branches: [main, production] + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + to-do: + runs-on: ubuntu-latest + steps: + - run: echo "CI goes here" diff --git a/.github/workflows/develop-deploy.yml b/.github/workflows/develop-deploy.yml new file mode 100644 index 000000000..aa2b112ae --- /dev/null +++ b/.github/workflows/develop-deploy.yml @@ -0,0 +1,38 @@ +name: Develop Deploy + +on: + workflow_run: + workflows: [CI] + types: [completed] + branches: [main] + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.CI_DEPLOY_KEY }} + name: id_goodbids + known_hosts: unnecessary # Actions have have github.com in known_hosts by default + config: | + Host github.com + HostName github.com + IdentityFile /home/runner/.ssh/id_goodbids + if_key_exists: fail + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Push to remote + run: | + git config --unset-all http.https://github.com/.extraheader + git config user.name "GitHub Actions" + git config user.email github-actions@github.com + git remote add wpvip git@github.com:wpcomvip/goodbids.git + git push -f wpvip main:develop diff --git a/.github/workflows/production-deploy.yml b/.github/workflows/production-deploy.yml new file mode 100644 index 000000000..a94fe22ae --- /dev/null +++ b/.github/workflows/production-deploy.yml @@ -0,0 +1,39 @@ +name: Production Deploy + +on: + workflow_run: + workflows: [CI] + types: [completed] + branches: [production] + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.CI_DEPLOY_KEY }} + name: id_goodbidsNode + known_hosts: unnecessary # Actions have have github.com in known_hosts by default + config: | + Host github.com + HostName github.com + IdentityFile /home/runner/.ssh/id_goodbidsNode + if_key_exists: fail + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: production + + - name: Push to remote + run: | + git config --unset-all http.https://github.com/.extraheader + git config user.name "GitHub Actions" + git config user.email github-actions@github.com + git remote add wpvip git@github.com:wpcomvip/goodbids.git + git push -f wpvip production:production