Skip to content

Refactor devcontainer configuration filenames #1

Refactor devcontainer configuration filenames

Refactor devcontainer configuration filenames #1

Workflow file for this run

name: 'release'
on:
# rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- develop
permissions:
# write-all is too much, but we need to write to packages
# see https://github.com/orgs/community/discussions/57724 for more info
contents: read
packages: write
attestations: write
id-token: write
jobs:
devcontainer-image:
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: "./.github/shared/devcontainer-image-name"
id: devcontainer_image_name
- name: Pre-build image and run make ci-build in dev container
uses: devcontainers/ci@v0.3
with:
# push image only if the branch is main and the event is push
push: filter
refFilterForPush: |
refs/heads/main
refs/heads/develop
eventFilterForPush: |
push
# use the devcontainer_image_name output variable produced by ./.github/shared/devcontainer-image-name.yaml
imageName: ${{ steps.devcontainer_image_name.outputs.image_name }}
build:
runs-on: ubuntu-latest
needs: devcontainer-image
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v4
- uses: "./.github/shared/devcontainer-image-name"
id: devcontainer_image_name
- name: use devcontainer image
uses: devcontainers/ci@v0.3
with:
# use the devcontainer_image_name output variable produced by ./.github/shared/devcontainer-image-name.yaml
cacheFrom: ${{ steps.devcontainer_image_name.outputs.image_name }}
# make some tests to test the devcontainer image is working
runCmd: |
# test if pnpm is properly installed
command -v pnpm
# test if devcontainer environment is properly set
env | grep WP_ENV_HOME