From 61349a1d57a50822f2bd96f813a803a6dc7fe6f4 Mon Sep 17 00:00:00 2001 From: ifurther <55025025+ifurther@users.noreply.github.com> Date: Sun, 14 Jan 2024 21:29:16 +0800 Subject: [PATCH] add vagrantcloud-update to check vagrant cloud is public --- .github/workflows/release.yml | 3 +++ Makefile | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e37dab8..15bfab0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,6 +41,9 @@ jobs: ATLAS_TOKEN: ${{ secrets.ATLAS_TOKEN }} run: CI_VERSION=${GITHUB_REF#refs/heads/nixos-} make vagrantcloud-delete + - name: Set Vagrant Cloud Box is Public + run: make vagrantcloud-update + - name: Setup `packer` uses: hashicorp/setup-packer@main id: setup diff --git a/Makefile b/Makefile index 8a88329..7e56850 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ BUILDER ?= virtualbox-iso.virtualbox VERSION ?= 23.05 ARCH ?= x86_64 REPO ?= nixbox/nixos -CI_VERSION ?= ${GITHUB_REF#refs/heads/nixos-} REPO_NAME = $(word 1, $(subst /, ,${REPO})) BOX_NAME = $(word 2, $(subst /, ,${REPO})) BUILD_PROVIDER = $(word 2, $(subst ., ,${BUILDER})) @@ -68,11 +67,13 @@ vagrantcloud-delete: ## Delete old Vagrant Cloud box --header "Authorization: Bearer ${ATLAS_TOKEN}" \ "https://app.vagrantup.com/api/v2/box/${REPO}/version/${CI_VERSION}" -vagrantcloud-release: ## Release Vagrant Cloude box +vagrantcloud-update: ## Update Vagrant Cloud box @curl \ --request PUT \ + --header "Content-Type: application/json" \ --header "Authorization: Bearer ${ATLAS_TOKEN}" \ - "https://app.vagrantup.com/api/v2/box/${REPO}/version/${CI_VERSION}/release" + "https://app.vagrantup.com/api/v2/box/${REPO}" \ + --data '{ "box": { "username": "'"${REPO_NAME}"'", "name": "'"${BOX_NAME}"'", "is_private": false } }' packer-build: nixos.pkr.hcl version ##Use packer push to vagrant-cloud packer init $<