ci: update generated copier template from example #16
Workflow file for this run
This file contains hidden or 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
| name: Continuous Integration From Template | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - '{{app_name}}/**' | |
| workflow_dispatch: | |
| jobs: | |
| generate-from-template: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v4 | |
| with: | |
| # checkout the pull request head ref when available, otherwise fallback to the workflow ref | |
| ref: ${{ github.head_ref || github.ref }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install copier | |
| run: | | |
| pip install --upgrade pip copier | |
| - name: Generate from default context (copier) | |
| run: | | |
| # Use the repo root as the template directory and generate into ./cart-service | |
| # Use copier.yml as the default data file with --defaults and --force to overwrite any existing generated output. | |
| copier copy . . --defaults --force | |
| - name: Upload generated cart-service as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cart-service | |
| path: ./cart-service | |
| cart-service-ci: | |
| needs: generate-from-template | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download generated cart-service artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: cart-service | |
| path: ./cart-service | |
| - name: Show downloaded files | |
| run: | | |
| echo "Working dir: $(pwd)" | |
| ls -la ./cart-service | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Build with Maven | |
| run: git init && mvn clean verify -ntp | |
| working-directory: ./cart-service |