Skip to content

Commit

Permalink
add vagrantcloud-update to check vagrant cloud is public
Browse files Browse the repository at this point in the history
  • Loading branch information
ifurther committed Jan 14, 2024
1 parent 5ff0817 commit 61349a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}))
Expand Down Expand Up @@ -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 $<
Expand Down

0 comments on commit 61349a1

Please sign in to comment.