Hotfix/show popup after leave offer #590
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: Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
types: [opened, synchronize, reopened] | |
permissions: | |
contents: write | |
jobs: | |
release-snapshot: | |
if: github.event_name == 'pull_request' | |
name: Release Snapshot | |
runs-on: ubuntu-latest | |
environment: local | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Get Project Version | |
id: get_version | |
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV | |
- name: Check for existing release tag (only on PR) | |
if: github.event_name == 'pull_request' | |
env: | |
VERSION: ${{ env.VERSION }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
TAG_EXISTS=$(curl -H "Authorization: token $GITHUB_TOKEN" -s https://api.github.com/repos/${{ github.repository }}/releases | jq -r ".[] | select(.tag_name == \"v$VERSION\") | .tag_name") | |
if [ "$TAG_EXISTS" == "v$VERSION" ]; then | |
echo "Release tag v$VERSION already exists. Rejecting PR." | |
exit 1 | |
else | |
echo "No existing release with tag v$VERSION found. Proceeding with build." | |
fi | |
- name: Build and Push docker image | |
run: | | |
PROJECT_NAME=$(jq -r '.name' package.json) | |
IMAGE_TAG="$PROJECT_NAME:v$VERSION$SUFFIX" | |
docker build . --file Dockerfile --tag $DOCKER_HUB_CLIENT_NAME/$IMAGE_TAG | |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin | |
docker push $DOCKER_HUB_CLIENT_NAME/$IMAGE_TAG | |
env: | |
VERSION: ${{ env.VERSION }} | |
SUFFIX: -snapshot | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }} | |
DOCKER_HUB_CLIENT_NAME: in2workspace | |
release: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
name: Release | |
runs-on: ubuntu-latest | |
environment: local | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Get Project Version | |
id: get_version | |
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV | |
- name: Check for existing release tag (only on PR) | |
if: github.event_name == 'pull_request' | |
env: | |
VERSION: ${{ env.VERSION }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
TAG_EXISTS=$(curl -H "Authorization: token $GITHUB_TOKEN" -s https://api.github.com/repos/${{ github.repository }}/releases | jq -r ".[] | select(.tag_name == \"v$VERSION\") | .tag_name") | |
if [ "$TAG_EXISTS" == "v$VERSION" ]; then | |
echo "Release tag v$VERSION already exists. Rejecting PR." | |
exit 1 | |
else | |
echo "No existing release with tag v$VERSION found. Proceeding with build." | |
fi | |
- name: Build and Push docker image | |
run: | | |
PROJECT_NAME=$(jq -r '.name' package.json) | |
IMAGE_TAG="$PROJECT_NAME:v$VERSION" | |
docker build . --file Dockerfile --tag $DOCKER_HUB_CLIENT_NAME/$IMAGE_TAG | |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin | |
docker push $DOCKER_HUB_CLIENT_NAME/$IMAGE_TAG | |
env: | |
VERSION: ${{ env.VERSION }} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }} | |
DOCKER_HUB_CLIENT_NAME: in2workspace | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ env.VERSION }}" | |
release_name: "v${{ env.VERSION }}" | |
body: "Release of version v${{ env.VERSION }}" | |
draft: false | |
prerelease: false |