feat: add working-directory input (#210) #54
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: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker login | |
run: | | |
echo "$GCR_TOKEN" | docker login ghcr.io -u codfish --password-stdin | |
env: | |
GCR_TOKEN: ${{ secrets.GCR_TOKEN }} | |
# Step to create a list of tags to push to GCR always including the latest tag and optionally | |
# the new release tag and major release tag. | |
- name: Create tags list | |
id: tags | |
shell: bash | |
run: | | |
TAGS="ghcr.io/codfish/semantic-release-action:latest" | |
if [ "${{ steps.semantic.outputs.new-release-published }}" == "true" ]; then | |
TAGS="${TAGS},ghcr.io/codfish/semantic-release-action:v${{ steps.semantic.outputs.release-version }}" | |
TAGS="${TAGS},ghcr.io/codfish/semantic-release-action:v${{ steps.semantic.outputs.release-major }}" | |
fi | |
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT" | |
# Push docker images to GCR | |
# Dockerhub is auto synced with the repo, no need to explicitly deploy | |
- name: Build and push docker images to GCR | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/arm64,linux/amd64 | |
push: true | |
tags: ${{ steps.tags.outputs.tags }} |