|
| 1 | +name: Archive CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' # Trigger on version tags like v1.2.3 |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + container: |
| 12 | + image: ubuntu:22.04 # Base container for building |
| 13 | + |
| 14 | + env: |
| 15 | + PROJECT_NAME: fossil-test |
| 16 | + BUILD_DIR: builddir |
| 17 | + DIST_DIR: dist |
| 18 | + GHCR_IMAGE: ghcr.io/${{ github.repository_owner }}/fossil-test:latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v3 |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + run: | |
| 26 | + apt update |
| 27 | + apt install -y python3 python3-pip meson ninja-build build-essential curl docker.io git |
| 28 | + pip3 install --upgrade pip |
| 29 | +
|
| 30 | + - name: Set up Meson build |
| 31 | + run: | |
| 32 | + meson setup $BUILD_DIR |
| 33 | +
|
| 34 | + - name: Compile project |
| 35 | + run: meson compile -C $BUILD_DIR |
| 36 | + |
| 37 | + - name: Generate source archives |
| 38 | + run: | |
| 39 | + meson dist -C $BUILD_DIR --formats xztar,bztar,gztar,zip |
| 40 | + mkdir -p $DIST_DIR |
| 41 | + cp $BUILD_DIR/meson-dist/* $DIST_DIR/ |
| 42 | +
|
| 43 | + - name: List archives |
| 44 | + run: ls -l $DIST_DIR |
| 45 | + |
| 46 | + - name: Build Docker image |
| 47 | + run: | |
| 48 | + # Dockerfile should be in repo root |
| 49 | + docker build -t $GHCR_IMAGE . |
| 50 | +
|
| 51 | + - name: Log in to GitHub Container Registry |
| 52 | + uses: docker/login-action@v2 |
| 53 | + with: |
| 54 | + registry: ghcr.io |
| 55 | + username: ${{ github.actor }} |
| 56 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + |
| 58 | + - name: Push Docker image |
| 59 | + run: docker push $GHCR_IMAGE |
| 60 | + |
| 61 | + - name: Upload artifacts |
| 62 | + uses: actions/upload-artifact@v3 |
| 63 | + with: |
| 64 | + name: source-archives |
| 65 | + path: $DIST_DIR/ |
0 commit comments