Skip to content

Fix release tag #2

Fix release tag

Fix release tag #2

Workflow file for this run

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: Generate tag
id: tag
run: |
TAG="v$(date +'%Y-%m-%d')-$(git rev-parse --short HEAD)"
echo "::set-output name=tag::$TAG"
- name: Create release
uses: softprops/action-gh-release@v1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.tag.outputs.tag }}
name: "Release ${{ steps.tag.outputs.tag }}"
body: "Automated release for tag ${{ steps.tag.outputs.tag }}."
files: ./exec