forked from paritytech/get-fellows-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
51 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,50 +37,43 @@ jobs: | |
env: | ||
FILE_NAME: ".github/workflows/review-bot.yml" | ||
|
||
test-versions: | ||
compare-versions: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.verification.outputs.VERSION }} | ||
exists: ${{ steps.package_version.outputs.VERSION }} | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Extract package.json version | ||
id: package_version | ||
run: echo "VERSION=$(jq '.version' -r package.json)" >> $GITHUB_OUTPUT | ||
# Compare that the versions contain the same name | ||
- name: Compare versions | ||
id: verification | ||
uses: Bullrich/compare-version-on-action@main | ||
with: | ||
version: ${{ steps.package_version.outputs.VERSION }} | ||
# Verifies if there is a tag with that version number | ||
- uses: mukunku/[email protected] | ||
if: steps.verification.outputs.VERSION | ||
id: checkTag | ||
with: | ||
tag: v${{ steps.package_version.outputs.VERSION }} | ||
|
||
tag: | ||
if: github.event_name == 'push' && needs.test-versions.outputs.version != '' | ||
# needs: [test-image, test-versions] | ||
needs: [test-versions] | ||
publish: | ||
if: github.event_name == 'push' && needs.compare-versions.outputs.exists == 'false' | ||
needs: [test-image, compare-versions] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
outputs: | ||
tagExists: ${{ steps.checkTag.outputs.exists }} | ||
packages: write | ||
steps: | ||
- uses: mukunku/[email protected] | ||
id: checkTag | ||
with: | ||
tag: v${{ needs.test-versions.outputs.version }} | ||
- uses: actions/[email protected] | ||
- name: Tag version and create release | ||
if: steps.checkTag.outputs.exists == 'false' | ||
run: gh release create $VERSION --generate-notes | ||
env: | ||
VERSION: ${{ needs.test-versions.outputs.version }} | ||
VERSION: ${{ needs.compare-versions.outputs.version }} | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
# !Undo this | ||
needs: [test-versions] | ||
steps: | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
|
@@ -92,11 +85,7 @@ jobs: | |
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }} | ||
tags: ${{ needs.test-versions.outputs.version }} | ||
- run: echo "Tags are $tags and labels are $labels" | ||
env: | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
tags: ${{ needs.compare-versions.outputs.version }} | ||
- uses: actions/checkout@v3 | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
|
@@ -105,28 +94,3 @@ jobs: | |
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
# - uses: actions/checkout@v3 | ||
# - name: Build image | ||
# run: docker build . --file Dockerfile --label "version=$TAG" --tag $IMAGE_NAME | ||
# env: | ||
# TAG: v${{ needs.test-versions.outputs.version }} | ||
# - name: Log into registry | ||
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin | ||
# - name: Push image | ||
# run: | | ||
# IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME | ||
# # Change all uppercase to lowercase | ||
# IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# # Strip git ref prefix from version | ||
# VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# # Strip "v" prefix from tag name | ||
# [[ ! -z $TAG ]] && VERSION=$(echo $TAG | sed -e 's/^v//') | ||
# # Use Docker `latest` tag convention | ||
# [ "$VERSION" == "main" ] && VERSION=latest | ||
# echo IMAGE_ID=$IMAGE_ID | ||
# echo VERSION=$VERSION | ||
# docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
# docker push $IMAGE_ID:$VERSION | ||
# env: | ||
# TAG: v${{ needs.test-versions.outputs.version }} |