Initial commit #1
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
name: Test and Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and test | |
run: | | |
docker build -t exec-test . | |
docker run exec-test | |
release: | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build release binary | |
run: | | |
docker build --target builder -t exec-builder . | |
docker create --name extract exec-builder | |
docker cp extract:/usr/bin/exec ./exec | |
docker rm extract | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ github.sha }} | |
name: "Release ${{ github.sha }}" | |
body: "Automated release for commit ${{ github.sha }}." | |
files: ./exec |