Skip to content

Commit 8c908a0

Browse files
committed
feat: initialize repository
0 parents  commit 8c908a0

File tree

8 files changed

+990
-0
lines changed

8 files changed

+990
-0
lines changed

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release package
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
if: github.ref == 'refs/heads/main'
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [18.9.x]
13+
steps:
14+
- uses: pnpm/action-setup@v2
15+
with:
16+
version: 8.6.0
17+
18+
- name: Get pnpm store directory
19+
id: pnpm-cache
20+
shell: bash
21+
run: |
22+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
23+
24+
- uses: actions/cache@v3
25+
name: Setup pnpm cache
26+
with:
27+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
28+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
29+
restore-keys: |
30+
${{ runner.os }}-pnpm-store-
31+
32+
- name: Get current date
33+
id: date
34+
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M')"
35+
36+
- uses: actions/checkout@v3
37+
38+
- name: git config
39+
run: |
40+
git config user.name "${GITHUB_ACTOR}"
41+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
42+
43+
- name: npm config
44+
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
45+
env:
46+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
48+
- name: Use Node.js ${{ matrix.node-version }}
49+
uses: actions/setup-node@v3
50+
with:
51+
node-version: ${{ matrix.node-version }}
52+
53+
- name: Install dependencies
54+
run: pnpm i --frozen-lockfile
55+
56+
- name: Build
57+
run: pnpm run build
58+
59+
- name: Git reset
60+
run: git reset --hard
61+
62+
- name: Release
63+
run: pnpm release
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/node,macos
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos
3+
4+
### macOS ###
5+
# General
6+
.DS_Store
7+
.AppleDouble
8+
.LSOverride
9+
10+
# Icon must end with two \r
11+
Icon
12+
13+
14+
# Thumbnails
15+
._*
16+
17+
# Files that might appear in the root of a volume
18+
.DocumentRevisions-V100
19+
.fseventsd
20+
.Spotlight-V100
21+
.TemporaryItems
22+
.Trashes
23+
.VolumeIcon.icns
24+
.com.apple.timemachine.donotpresent
25+
26+
# Directories potentially created on remote AFP share
27+
.AppleDB
28+
.AppleDesktop
29+
Network Trash Folder
30+
Temporary Items
31+
.apdisk
32+
33+
### macOS Patch ###
34+
# iCloud generated files
35+
*.icloud
36+
37+
### Node ###
38+
# Logs
39+
logs
40+
*.log
41+
npm-debug.log*
42+
yarn-debug.log*
43+
yarn-error.log*
44+
lerna-debug.log*
45+
.pnpm-debug.log*
46+
47+
# Diagnostic reports (https://nodejs.org/api/report.html)
48+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
49+
50+
# Runtime data
51+
pids
52+
*.pid
53+
*.seed
54+
*.pid.lock
55+
56+
# Directory for instrumented libs generated by jscoverage/JSCover
57+
lib-cov
58+
59+
# Coverage directory used by tools like istanbul
60+
coverage
61+
*.lcov
62+
63+
# nyc test coverage
64+
.nyc_output
65+
66+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
67+
.grunt
68+
69+
# Bower dependency directory (https://bower.io/)
70+
bower_components
71+
72+
# node-waf configuration
73+
.lock-wscript
74+
75+
# Compiled binary addons (https://nodejs.org/api/addons.html)
76+
build/Release
77+
78+
# Dependency directories
79+
node_modules/
80+
jspm_packages/
81+
82+
# Snowpack dependency directory (https://snowpack.dev/)
83+
web_modules/
84+
85+
# TypeScript cache
86+
*.tsbuildinfo
87+
88+
# Optional npm cache directory
89+
.npm
90+
91+
# Optional eslint cache
92+
.eslintcache
93+
94+
# Optional stylelint cache
95+
.stylelintcache
96+
97+
# Microbundle cache
98+
.rpt2_cache/
99+
.rts2_cache_cjs/
100+
.rts2_cache_es/
101+
.rts2_cache_umd/
102+
103+
# Optional REPL history
104+
.node_repl_history
105+
106+
# Output of 'npm pack'
107+
*.tgz
108+
109+
# Yarn Integrity file
110+
.yarn-integrity
111+
112+
# dotenv environment variable files
113+
.env
114+
.env.development.local
115+
.env.test.local
116+
.env.production.local
117+
.env.local
118+
119+
# parcel-bundler cache (https://parceljs.org/)
120+
.cache
121+
.parcel-cache
122+
123+
# Next.js build output
124+
.next
125+
out
126+
127+
# Nuxt.js build / generate output
128+
.nuxt
129+
dist
130+
131+
# Gatsby files
132+
.cache/
133+
# Comment in the public line in if your project uses Gatsby and not Next.js
134+
# https://nextjs.org/blog/next-9-1#public-directory-support
135+
# public
136+
137+
# vuepress build output
138+
.vuepress/dist
139+
140+
# vuepress v2.x temp and cache directory
141+
.temp
142+
143+
# Docusaurus cache and generated files
144+
.docusaurus
145+
146+
# Serverless directories
147+
.serverless/
148+
149+
# FuseBox cache
150+
.fusebox/
151+
152+
# DynamoDB Local files
153+
.dynamodb/
154+
155+
# TernJS port file
156+
.tern-port
157+
158+
# Stores VSCode versions used for testing VSCode extensions
159+
.vscode-test
160+
161+
# yarn v2
162+
.yarn/cache
163+
.yarn/unplugged
164+
.yarn/build-state.yml
165+
.yarn/install-state.gz
166+
.pnp.*
167+
168+
### Node Patch ###
169+
# Serverless Webpack directories
170+
.webpack/
171+
172+
# Optional stylelint cache
173+
174+
# SvelteKit build / generate output
175+
.svelte-kit
176+
177+
# project
178+
tmp

.release-it.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"git": {
3+
"commitMessage": "chore: release v${version}"
4+
},
5+
"github": {
6+
"release": true
7+
},
8+
"hooks": {
9+
"before:init": "git fetch --prune --prune-tags origin"
10+
},
11+
"plugins": {
12+
"@release-it/conventional-changelog": {
13+
"infile": "CHANGELOG.md",
14+
"preset": {
15+
"name": "conventionalcommits",
16+
"types": [
17+
{
18+
"type": "feat",
19+
"section": "Features"
20+
},
21+
{
22+
"type": "fix",
23+
"section": "Bug Fixes"
24+
},
25+
{}
26+
]
27+
}
28+
}
29+
}
30+
}

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# AWS Glacier: Clear vault
2+
Follow these steps to clear all archives from an AWS glacier vault.
3+
After this is finished, you will be able to delete the vault itself through the browser console.
4+
5+
## Step 1 / Retrieve inventory
6+
This will create a job that collects required information about the vault.
7+
```sh
8+
$ aws glacier initiate-job --job-parameters '{"Type": "inventory-retrieval"}' --account-id YOUR_ACCOUNT_ID --region YOUR_REGION --vault-name YOUR_VAULT_NAME
9+
```
10+
11+
This can take hours or even days, depending on the size of the vault.
12+
Use the following command to check if it is ready:
13+
```sh
14+
aws glacier list-jobs --account-id YOUR_ACCOUNT_ID --region YOUR_REGION --vault-name YOUR_VAULT_NAME
15+
```
16+
17+
Copy the `JobId` (including the quotes) for the next step.
18+
19+
## (Alternative Step / Set Job Notification)
20+
If you do not want to check your job status continously, you can create a notification to receive a email when your job is finished. [Configuring Vault Notifications Using the AWS Command Line Interface](https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications-cli.html)
21+
22+
```sh
23+
aws glacier set-vault-notifications --account-id YOUR_ACCOUNT_ID --vault-name YOUR_VAULT_NAME --vault-notification-config ~/notificationconfig.json
24+
```
25+
26+
Or you enable it via the aws console: [Configuring Vault Notifications by Using the S3 Glacier Console](https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications-console.html)
27+
28+
## Step 2 / Get the ArchivesIds
29+
The following command will result in a file listing all archive IDs, required for `step 3`.
30+
```sh
31+
$ aws glacier get-job-output --account-id YOUR_ACCOUNT_ID --region YOUR_REGION --vault-name YOUR_VAULT_NAME --job-id YOUR_JOB_ID ./job-output.json
32+
```
33+
34+
## Step 3 / Delete archives
35+
Set the following parameters through environment variables:
36+
```sh
37+
export AWS_ACCOUNT_ID=YOUR_ACCOUNT_ID
38+
export AWS_VAULT_NAME=YOUR_VAULT_NAME
39+
```
40+
41+
And run the script via npx/pnpx:
42+
```sh
43+
npx @chieforz/clear-aws-glacier ./archive-log.json
44+
45+
pnpx @chieforz/clear-aws-glacier ./archive-log.json
46+
```
47+
48+
All additional parameters will be passed to the aws cli sdk:
49+
[Command line options](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-options.html)
50+
51+
For debugging you can pass --verbose to disable the progress bar.
52+
53+
# Acknowledgement
54+
This tutorial is based on: [https://gist.github.com/Remiii/507f500b5c4e801e4ddc
55+
icon](https://gist.github.com/veuncent/ac21ae8131f24d3971a621fac0d95be5)

package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "@chieforz/clear-aws-glacier",
3+
"version": "1.0.0",
4+
"description": "",
5+
"keywords": [
6+
"aws",
7+
"glacier",
8+
"clear",
9+
"delete",
10+
"node.js",
11+
"typescript"
12+
],
13+
"license": "MIT",
14+
"author": "ChiefORZ <seb.schaffernak@gmail.com>",
15+
"type": "module",
16+
"main": "dist/main.js",
17+
"bin": "dist/index.js",
18+
"files": [
19+
"dist"
20+
],
21+
"scripts": {
22+
"build": "tsc"
23+
},
24+
"dependencies": {
25+
"@t3-oss/env-core": "^0.6.0",
26+
"cli-progress": "^3.12.0",
27+
"fast-glob": "^3.3.0",
28+
"zod": "^3.21.4",
29+
"zx": "^7.2.3"
30+
},
31+
"devDependencies": {
32+
"@types/node": "^20.4.1"
33+
},
34+
"engines": {
35+
"node": ">=18.0.0"
36+
}
37+
}

0 commit comments

Comments
 (0)