Skip to content

chore: update ci pipeline #7

chore: update ci pipeline

chore: update ci pipeline #7

Workflow file for this run

name: Build Docker Image and Publish Release
on:
push:
tags:
- 'v*.*.*'
jobs:
build_and_release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build Docker image
run: |
REPO_NAME=${{ github.repository }}
LOWERCASE_REPO_NAME=$(echo "$REPO_NAME" | tr '[:upper:]' '[:lower:]')
docker build -t ghcr.io/${{ github.actor }}/$LOWERCASE_REPO_NAME:${{ github.ref_name }} .
- name: Push Docker image to GitHub Container Registry
run: |
REPO_NAME=${{ github.repository }}
LOWERCASE_REPO_NAME=$(echo "$REPO_NAME" | tr '[:upper:]' '[:lower:]')
docker push ghcr.io/${{ github.actor }}/$LOWERCASE_REPO_NAME:${{ github.ref_name }}
- name: Generate release notes
id: generate_release_notes
run: |
release_notes=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"* %s (%an)" | sed 's/\\n/\\n\\n/g')
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$release_notes" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create .tar.gz archive of repository files
run: |
git archive --format=tar.gz --prefix=TeamSpiralRacing/ -o release-${{ github.ref_name }}.tar.gz HEAD
- name: Upload .tar.gz archive as a GitHub Release asset
id: release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: ${{ env.RELEASE_NOTES }}
files: release-${{ github.ref_name }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output Release URL
run: |
echo "Release URL: ${{ steps.release.outputs.html_url }}"