ci: use pull_request_target event for validation workflow #46
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 | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: semantic-release | |
id: semantic | |
uses: ./ | |
with: | |
branches: | | |
[ | |
'+([0-9])?(.{+([0-9]),x}).x', | |
'main', | |
'next', | |
'next-major', | |
{ | |
name: 'beta', | |
prerelease: true | |
}, | |
{ | |
name: 'alpha', | |
prerelease: true | |
} | |
] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Dump semantic outputs | |
if: steps.semantic.outputs.new-release-published == 'true' | |
run: | | |
echo "Outputs:\n" | |
echo "$SEMANTIC_OUTPUTS" | |
echo "\n-----\n\nEnvironment Variables:\n" | |
echo "NEW_RELEASE_PUBLISHED: $NEW_RELEASE_PUBLISHED" | |
echo "RELEASE_VERSION: $RELEASE_VERSION" | |
echo "RELEASE_MAJOR: $RELEASE_MAJOR" | |
echo "RELEASE_MINOR: $RELEASE_MINOR" | |
echo "RELEASE_PATCH: $RELEASE_PATCH" | |
echo "RELEASE_NOTES: $RELEASE_NOTES" | |
echo "RELEASE_TYPE: $RELEASE_TYPE" | |
echo "RELEASE_CHANNEL: $RELEASE_CHANNEL" | |
echo "RELEASE_GIT_HEAD: $RELEASE_GIT_HEAD" | |
echo "RELEASE_GIT_TAG: $RELEASE_GIT_TAG" | |
echo "RELEASE_NAME: $RELEASE_NAME" | |
env: | |
SEMANTIC_OUTPUTS: ${{ toJson(steps.semantic-dry-run.outputs) }} | |
- name: docker login | |
run: | | |
echo "$GCR_TOKEN" | docker login ghcr.io -u codfish --password-stdin | |
env: | |
GCR_TOKEN: ${{ secrets.GCR_TOKEN }} | |
# Dockerhub is auto synced with the repo, no need to explicitly deploy | |
- name: build and push latest docker image to GCR | |
run: | | |
docker build -t ghcr.io/codfish/semantic-release-action:latest . | |
docker push ghcr.io/codfish/semantic-release-action:latest | |
- name: push docker images for releases to GCR | |
if: steps.semantic.outputs.new-release-published == 'true' | |
run: | | |
docker tag ghcr.io/codfish/semantic-release-action ghcr.io/codfish/semantic-release-action:$VERSION_TAG | |
docker tag ghcr.io/codfish/semantic-release-action ghcr.io/codfish/semantic-release-action:$MAJOR_TAG | |
docker push ghcr.io/codfish/semantic-release-action:$VERSION_TAG | |
docker push ghcr.io/codfish/semantic-release-action:$MAJOR_TAG | |
env: | |
VERSION_TAG: v${{ steps.semantic.outputs.release-version }} | |
MAJOR_TAG: v${{ steps.semantic.outputs.release-major }} |