9 Commits

Author SHA1 Message Date
Kamesh Sampath 0e69cca81a Merge pull request #5 from dejaeghered/main
run as user node . This will be updated to be run as `root` later.
2022-10-06 18:59:00 +05:30
David Dejaeghere c45835df5e run as user node 2022-10-06 15:14:55 +02:00
Kamesh 80aee03ab0 fix: add extra parameters
- site directory
- environment file
2022-07-12 18:50:31 +05:30
Kamesh 1d4f887128 feat!: prepare and push release 2022-07-11 19:46:47 +05:30
Kamesh 6cb81ef2d3 remove auto release of image 2022-07-11 13:14:03 +05:30
Kamesh Sampath 1563dc837e Merge pull request #3 from kameshsampath/release-please--branches--main--components--release-please-action
chore(main): release 0.0.2
2022-07-11 13:12:11 +05:30
github-actions[bot] 05a2b9a9c1 chore(main): release 0.0.2 2022-07-11 07:41:37 +00:00
Kamesh b7e9641585 fix: workflow 2022-07-11 13:11:17 +05:30
Kamesh a25ede7eae workflow id updated 2022-07-11 13:07:40 +05:30
7 changed files with 49 additions and 77 deletions
-41
View File
@@ -1,41 +0,0 @@
name: Release Image
on:
release:
types:
- "released"
workflow_dispatch:
env:
PLUGIN_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/drone-vercel-deploy
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
id: docker-hub-login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Release Image
env:
TAG_NAME: ${{ github.event.release.tag_name }}
PLUGIN_IMAGE_NAME: ${{ env.PLUGIN_IMAGE_NAME }}
id: build and release plugin image
run: |
docker build \
--build-arg BUILDKIT_MULTI_PLATFORM=1 \
--platform=linux/amd64 \
--platform=linux/arm64 \
--push \
--tag $PLUGIN_IMAGE_NAME:$TAG \
-f docker/Dockerfile .
docker tag $PLUGIN_IMAGE_NAME:$TAG $PLUGIN_IMAGE_NAME
docker push $PLUGIN_IMAGE_NAME
-14
View File
@@ -1,14 +0,0 @@
on:
push:
branches:
- main
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: simple
package-name: release-please-action
bump-minor-pre-major: true
+7
View File
@@ -1,5 +1,12 @@
# Changelog
## [0.0.2](https://github.com/kameshsampath/drone-vercel-deploy/compare/v0.0.1...v0.0.2) (2022-07-11)
### Bug Fixes
* workflow ([b7e9641](https://github.com/kameshsampath/drone-vercel-deploy/commit/b7e9641585f1934e00add177a707ebb70eef3a39))
## [0.0.1](https://github.com/kameshsampath/drone-vercel-deploy/compare/v0.0.0...v0.0.1) (2022-07-11)
+18 -19
View File
@@ -1,28 +1,27 @@
IMAGE?=kameshsampath/drone-vercel-deploy
TAG?=latest
SHELL := bash
CURRENT_DIR = $(shell pwd)
PLUGIN_IMAGE_NAME := docker.io/kameshsampath/drone-vercel-deploy
DRONE_FILE = .drone.yml
ENV_FILE := $(CURRENT_DIR)/.env
BUILDER=buildx-multi-arch
DOCKER_FILE=$(CURRENT_DIR)/docker/Dockerfile
build-and-load: ## Builds and loads the image into local docker context
@docker buildx build \
--tag $(PLUGIN_IMAGE_NAME) \
--load \
-f "$(CURRENT_DIR)/docker/Dockerfile" "$(CURRENT_DIR)"
prepare-buildx: ## Create buildx builder for multi-arch build, if not exists
docker buildx inspect $(BUILDER) || docker buildx create --name=$(BUILDER) --driver=docker-container --driver-opt=network=host
deploy-and-test: build-and-load ## Builds, loads the image into local docker and tests
@drone exec --secret-file="examples/nextjs-blog/secret.local" examples/nextjs-blog/.drone.yml
build-plugin: ## Build plugin image locally
docker build --tag=$(IMAGE):$(shell svu next) -f $(DOCKER_FILE) .
docker tag $(IMAGE):$(shell svu next) $(IMAGE):$(TAG)
build-and-push: ## Builds and pushes the image to Container Registry
@docker buildx build \
--build-arg BUILDKIT_MULTI_PLATFORM=1 \
--platform=linux/amd64 \
--platform=linux/arm64 \
--push \
--metadata-file="$(CURRENT_DIR)/docker/metadata.json" \
--tag $(PLUGIN_IMAGE_NAME) \
-f "$(CURRENT_DIR)/docker/Dockerfile" "$(CURRENT_DIR)"
push-plugin: prepare-buildx ## Build & Upload extension image to hub. Do not push if tag already exists: TAG=$(svu c) make push-extension
docker pull $(IMAGE):$(shell svu c) && echo "Failure: Tag already exists" || docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(shell svu c) --tag=$(IMAGE):$(shell svu c) -f $(DOCKER_FILE) .
release:
git tag "$(shell svu next)"
git push --tags
help: ## Show this help
@echo Please specify a build target. The choices are:
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(INFO_COLOR)%-30s$(NO_COLOR) %s\n", $$1, $$2}'
.PHONY: build-and-load build-and-push
.PHONY: bin build-plugin push-plugin help
+1
View File
@@ -12,6 +12,7 @@ The following settings changes this plugin's behavior.
* `vercel_project_create`: (optional) If true then name of the project specified by __vercel_project_id__ will be created and site will be deployed to that project. Defaults `false`.
* `vercel_environment`: (optional) The vercel environment to deploy. It could be one of `development`, `preview` or `production`. Defaults to `development`
* `vercel_environment_variables`: (optional) An array of __KEY=VALUE__ pair of environment variables will be added to site project at __vercel_environment__ scope.
* `vercel_environment_variable_file`: (optional) An environment variable file, with each line being a __KEY=VALUE__ pairs
* `log_level`: If set to debug enable scripting debug
To use the plugin create a secret file called `secret.local` with following variables,
+1 -3
View File
@@ -8,11 +8,9 @@ RUN apk -Uuv add bash curl ca-certificates jq
RUN npm i --location=global vercel
RUN adduser --system --uid 1001 -G root dev
ADD run.sh /bin/
RUN chmod +x /bin/run.sh
USER dev
USER node
CMD ["/bin/run.sh"]
+22
View File
@@ -16,6 +16,15 @@ then
printf "\n Vercel Environment %s \n" "${VERCEL_ENV}"
fi
if [ -z "${PLUGIN_VERCEL_SITE_DIR}" ];
then
PLUGIN_VERCEL_SITE_DIR=.
fi
printf "\nUsing directory '%s' as site directory\n" "${PLUGIN_VERCEL_SITE_DIR}"
cd "${PLUGIN_VERCEL_SITE_DIR}"
VERCEL_COMMAND+=("vercel" "deploy" "--prebuilt" "-t" "${PLUGIN_VERCEL_TOKEN}")
if [ "${VERCEL_ENV}" == "production" ];
@@ -65,6 +74,19 @@ then
printf " \n Vercel Runtime Env %s \n" "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLES}"
fi
if [ -f "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLE_FILE}" ];
then
printf " \n Loading Environment variable files from %s \n" "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLE_FILE}"
while IFS= read -r l; do
if [ -n "$PLUGIN_VERCEL_ENVIRONMENT_VARIABLES" ];
then
PLUGIN_VERCEL_ENVIRONMENT_VARIABLES="$PLUGIN_VERCEL_ENVIRONMENT_VARIABLES,$l"
else
PLUGIN_VERCEL_ENVIRONMENT_VARIABLES="$l"
fi
done < "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLE_FILE}"
fi
OLDIFS=$IFS
if [ -n "${PLUGIN_VERCEL_ENVIRONMENT_VARIABLES}" ] ;
then