Skip to content

Atualizando Github Actions - Encode url parameter #8

Atualizando Github Actions - Encode url parameter

Atualizando Github Actions - Encode url parameter #8

Workflow file for this run

# This GitHub Action demonstrates building a Docker image,
# pushing it to Docker Hub, and creating a Render build
# preview with every push to the main branch.
#
# This Action requires setting the following secrets:
#
# - DOCKERHUB_USERNAME
# - DOCKERHUB_ACCESS_TOKEN (create in Docker Hub)
# - RENDER_API_KEY (create from the Account Settings page)
# - RENDER_SERVICE_ID (the service to create a preview for)
#
# You must also set env.DOCKERHUB_REPOSITORY_URL below.
#
# Remember to delete previews when you're done with them!
# You can do this from the Render Dashboard or via the
# Render API.
name: Preview Docker Image on Render
# Fires whenever commits are pushed to the main branch
# (including when a PR is merged)
on:
push:
branches: [ "main" ]
env:
# Replace with the URL for your image's repository
DOCKERHUB_REPOSITORY_URL: docker.io/joaoallmeida/calculadora-fiis
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag $DOCKERHUB_REPOSITORY_URL:$(date +%s)
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Docker Metadata action
uses: docker/[email protected]
id: meta
with:
images: ${{env.DOCKERHUB_REPOSITORY_URL}}
- name: Build and push Docker image
uses: docker/[email protected]
id: build
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ BUILD_NUMBER }}

Check failure on line 56 in .github/workflows/deploy.yaml

View workflow run for this annotation

GitHub Actions / Preview Docker Image on Render

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yaml (Line: 56, Col: 15): Unrecognized named-value: 'BUILD_NUMBER'. Located at position 1 within expression: BUILD_NUMBER .github/workflows/deploy.yaml (Line: 60, Col: 12): Unrecognized named-value: 'BUILD_NUMBER'. Located at position 1 within expression: BUILD_NUMBER
labels: ${{ steps.meta.outputs.labels }}
- name: Encode Parameter
run: |
echo ::set-env name=PARAM_ENCODE::$(echo `${{ env.DOCKERHUB_REPOSITORY_URL }}:${{ BUILD_NUMBER }} | sed 's|/|%2F|g' | sed 's|:|%2F|g'`)
- name: Deploy Render Service
uses: fjogeleit/http-request-action@v1
with:
url: https://api.render.com/deploy/${{ secrets.RENDER_SERVICE_ID }}?key=${{ secrets.HOOK_KEY_ID }}&imgURL=${{ env.PARAM_ENCODE }}
method: 'POST'