Update ci.yml
This commit is contained in:
parent
9e97712811
commit
97c219ef43
69
.github/workflows/ci.yml
vendored
69
.github/workflows/ci.yml
vendored
@ -1,25 +1,62 @@
|
||||
name: Build
|
||||
name: Build and Release Lindbergh
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # Required to upload artifacts and create releases
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build Docker image and output
|
||||
uses: docker/build-push-action@v5
|
||||
steps:
|
||||
# Checkout the repository
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Set up Docker Buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
# Build the Docker image
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build --target lindbergh-build -t lindbergh-loader .
|
||||
|
||||
# Run the Docker container to extract the build output
|
||||
- name: Run container and extract build output
|
||||
run: |
|
||||
docker create --name lindbergh-builder lindbergh-loader
|
||||
docker cp lindbergh-builder:/lindbergh-loader/build ./build
|
||||
docker rm lindbergh-builder
|
||||
|
||||
# Archive the build directory as an artifact
|
||||
- name: Archive build directory
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
outputs: type=local,dest=build
|
||||
name: build-output
|
||||
path: ./build
|
||||
|
||||
# Create a GitHub release and upload the artifact
|
||||
- name: Create Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: v${{ github.run_number }}
|
||||
release_name: "Build v${{ github.run_number }}"
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./build
|
||||
asset_name: build.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
|
Loading…
x
Reference in New Issue
Block a user