-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub action CI support for repositories hosted outside of VIP G…
…itHub org (#235)
- Loading branch information
Showing
10 changed files
with
28,329 additions
and
38,304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Specify the issue number or Jira issue link: --> | ||
Fixes # | ||
|
||
## Tasks | ||
|
||
- [x] One important thing done. | ||
- [ ] Another left to do. | ||
|
||
## Describe the Approach | ||
|
||
- Use bullet points to describe the change. | ||
|
||
- Describe why the particular approach was chosen. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Build and Publish Docker Images | ||
|
||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/**' | ||
- 'docker-compose.yml' | ||
- 'local/docker/**' | ||
|
||
jobs: | ||
|
||
build-and-push-image: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build images | ||
run: docker-compose build | ||
|
||
- name: Publish images | ||
if: github.ref_name == 'master' | ||
run: docker buildx bake --push --set '*.platform=linux/amd64,linux/arm64' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Test and deploy | ||
|
||
on: push | ||
|
||
jobs: | ||
deploy: | ||
|
||
name: Lint, Test and Deploy | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
tools: composer:v2 | ||
|
||
- name: Get Composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache Composer packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
||
- name: Log in to the Docker container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Pull custom Docker images | ||
run: docker-compose pull wordpress mkcert | ||
|
||
- name: Install Node dependencies | ||
run: npm install --ignore-scripts | ||
|
||
- name: Install Composer dependencies | ||
run: composer install | ||
|
||
- name: Lint | ||
run: npm run lint | ||
|
||
- name: Setup tests | ||
run: mkdir uploads | ||
|
||
- name: Test | ||
run: npm run test | ||
|
||
- name: Setup SSH deploy key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.DEPLOY_SSH_KEY }} | ||
known_hosts: github.com | ||
|
||
- name: Setup Git credentials | ||
run: | | ||
git config --global user.name "XWP Deploy Bot" | ||
git config --global user.email "technology@xwp.co" | ||
- name: Deploy to develop | ||
if: github.ref_name == 'develop' | ||
run: npm run deploy-staging | ||
|
||
- name: Deploy to production | ||
if: github.ref_name == 'main' | ||
run: npm run deploy-production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Delete this file if using GitHub actions for CI. | ||
dist: bionic | ||
|
||
services: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.