Skip to content

Release v1.2.4.10 (#4587) #87

Release v1.2.4.10 (#4587)

Release v1.2.4.10 (#4587) #87

Workflow file for this run

name: GitHub Release
on:
push:
branches:
- main
paths:
- "Version.txt"
- ".github/workflows/ci-release.yml"
# Cancel any preceding run on the pull request.
concurrency:
group: release-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
if: ${{ github.repository == 'p4lang/p4c' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version
run: |
VERSION="$(cat Version.txt)"
TAG="v$(cat Version.txt)"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Check if tag exists
id: check_tag
run: |
TAG="${{ env.TAG }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, skipping release creation."
echo "tag_exists=true" >> $GITHUB_OUTPUT
else
echo "Tag $TAG does not exist."
echo "tag_exists=false" >> $GITHUB_OUTPUT
fi
- name: Release
if: steps.check_tag.outputs.tag_exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image to registry
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: p4lang/p4c:${{ env.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max