Skip to content

Commit

Permalink
added final version
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich committed Sep 29, 2023
1 parent a0327df commit e65bc3d
Showing 1 changed file with 15 additions and 51 deletions.
66 changes: 15 additions & 51 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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 }}

0 comments on commit e65bc3d

Please sign in to comment.